Is it possible to bind a model from both the Uri and Body?
For instance, given the following:
routes.MapHttpRoute(
name: \"API Default\",
rou
If I understood you, this should work out of the box, e.g. this works for me:
[HttpPost]
public ActionResult Test(TempModel model)
{
ViewBag.Message = "Test: " + model.Id +", " + model.Name;
return View("About");
}
public class TempModel
{
public int Id { get; set; }
public string Name { get; set; }
}
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
and on the request: localhost:56329/Home/Test/22 with body:{"Name":"tool"}
I have my model's properties set accordingly to 22 and "tool".