In ASP.NET MVC WebAPI project by default we have created following controller
public class ValuesController : ApiController
{
/
First Put this route to webapiconfig.cs
config.Routes.MapHttpRoute(
name: "ApiWithAction",
routeTemplate: "api/{controller}/{action}/{id}",
defaults: new { id = RouteParameter.Optional }
);
Now you can add actions to your controllers like this
[HttpPost]
public void Upload()
{
//Do some thing
}
I decorated upload action with httppost attribute that means this action accept just only post requests , if you want to actions to be GET , you can remove attribute or just decorate to your suite