I'm trying to use method in controller with HttpPatch annotation. My problem is that when i'm triggering that method, I have 404 error, resource not found. It seems that i'm not satisfying method needs and sending HttpPost request when i'm pressing "Patch" button instead of HttpPatch request. If anybody knows how to trigger my Patch method with HttpPatch annotation. Here is my controller:
[HttpPatch]
public ActionResult Patch()
{
return View();
}
Here is my view:
@model Practice.Models.PatchModel
<h2>Index</h2>
@using (Html.BeginForm("Patch", "Home"))
{
<div>
@Html.Label("Age")
<div>
@Html.TextBoxFor(model => model.age)
</div>
</div>
<div>
@Html.Label("ID")
<div>
@Html.TextBoxFor(model => model.id)
</div>
</div>
<input type="submit" value="Patch" />
}
and here is my model:
namespace Practice.Models
{
public class PatchModel
{
public int age { get; set; }
public int id { get; set; }
}
}