I have an authenticate function in my company controller
[ActionName("Authenticate")]
[HttpGet]
public bool Authenticate(Company company)
{
if (Uow.Companies.AuthenticateCompany(company))
return true;
return false;
}
that is called using the following ajax query
$.ajax({ url: "/api/company/Authenticate", type: 'get', data: company })
company is a js object
Company: function (name, phoneNumber, password) {
this.Name = name;
this.PhoneNumber = phoneNumber;
this.password = password;
}
var company = new Company($('#TextBoxCompanyName').val(),'00000000', $('#TextBoxCompanyPassword').val());
and my api route is as follows
config.Routes.MapHttpRoute(
name: "Action",
routeTemplate: "api/{controller}/{action}"
);
When the code runs the web api calls the following function in the company controller
public Company Get(int id)
{
return Uow.Companies.GetById(id);
}
How do I call a custom get function?
companyin the JS ($.ajax) code?"Action"should comes first then the default one.