My only problem with asp.net web api 2 is the inability to pass additional parameters the action, along with a base object. For example – if you want to update a contact, but keep track of where the update request came from (the location is not really part of the contact object) you cannot just add location as an additional parameter in addition to contact.
The only way of doing this is to add a parameter to the route – for example
[System.Web.Http.Route(“Ajax/v1.1/{locationArea}/SomeContactAction”)]
[OutputCache(NoStore = true, Duration = 0)]
[System.Web.Http.HttpPostAttribute]
public bool IsUniqueEmail(string locationArea,Contact contact)
{
//stuff happens
DoStuff(contact, locationArea);
return bool;
}
|
Written By Steve French |
Leave a Reply