Base solution for your next web application
Open Closed

Argument of type 'number' is not assignable to parameter of type 'EntityDtoOfInt32' #8520


User avatar
0
BobIngham created

.NET Core, Angular, aspnet Framework 4.7.2, Zero 6.8.0

These are two methods in my service;

public async Task Delete(EntityDto<int> input)
{
    await _ncDocumentRepository.DeleteAsync(input.Id);
}

public async Task Restore(EntityDto<int> input)
{
    using (_unitOfWorkManager.Current.DisableFilter(AbpDataFilters.SoftDelete))
    {
        var model = await _ncDocumentRepository.FirstOrDefaultAsync(m => m.Id == input.Id);
        model.IsDeleted = false;
        await _ncDocumentRepository.UpdateAsync(model);
    }
}

This is my service interface:

Task Delete(EntityDto<int> input);
Task Restore(EntityDto<int> input);

Here's a picture of my angular component:

And here's the offending code in service-proxies.ts:

I have recompiled, run a refresh on swagger, rebooted, slapped my forhead several times and then banged my head against the wall ten times. The problem still doesn't seem to go away. Anyone any ideas?


4 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    hi I guess the http verb for these two services is post. Please change them to get.

  • User Avatar
    0
    BobIngham created

    Hi @maliming, thanks for getting back. How do I do what you suggest in my service layer?

  • User Avatar
    0
    maliming created
    Support Team

    https://www.nuget.org/packages/Microsoft.AspNet.WebApi.Core

    https://aspnetboilerplate.com/Pages/Documents/Dynamic-Web-API#http-attributes

  • User Avatar
    0
    BobIngham created

    Thanks @maliming. I don't want to add another nuget package for the sake of declaring a [HttpGet] atttribute. This is down to naming conventions, by renaming the Restore method to GetRestore I was able to circumvent the problem. Hardly ideal, but hey-ho! Thanks for your help in the meantime, you pointed me in thye right direction.