I'm trying to change API routing using HTTP attributes from Microsoft.AspNet.WebApi.Core
NuGet package but can't get it working.
I've created the interface of service, implementation of this service and DTOs.
The DBAppServiceBase
is the AppServiceBase for my ASP.NET Zero application.
Code example below:
public class MyCustomAppService : DBAppServiceBase, IMyCustomAppService
{
[HttpGet]
public TestDto TestAction(TestInput input)
{
return new UploadFileDto
{
Id = Guid.NewGuid(),
Name = input.Name
};
}
}
By default the TestAction
is a HTTP POST. I want to change it to HTTP GET without changing its name.
I've already tested adding Get
prefix and it successfully changed the HTTP method to GET, but I don't want to add HTTP verb prefix to the action every time I want to change it from the HTTP POST.