Download from CodePlex: http://mvcapi.codeplex.com/
Setup
Person is our sample view model:
public class Person
{
public Guid Id { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public int Age { get; set; }
}
We decorate our controller's existing Create action with the [Api] attribute:
public class HomeController : Controller
{
[Api]
public ActionResult Create(Person person)
{
person.Id = Guid.NewGuid();
_people.Add(person);
return View(person);
}
}
Let's Play
Content Type:
Accept Type:
Request: