when using HTTP post to update my times record for example it works, but when i use put it doesn't. I have read some articles about CRUD and HTTP methods, and as known HTTP PUT is for the update part, is it only for WEB API or can i use it in my .net mvc project and im doing something wrong? Here's my code
var times = GetTimes(); // times array object
var enrollmentId = $('#EnrolledSubject').data('id');
$.ajax({
contentType: 'application/json; charset=utf-8',
url: "/Subjects/UpdateTimes?enrollmentId="+enrollmentId,
type: "PUT",
dataType: "json",
data: JSON.stringify({ 'times': times}),
success: function (data) {
console.log(data);
},
error: function (x, y, z) {
console.log('error ' + y);
OnAJAXError(x, y, z);
}
});
and MVC controller Subjects
[Route("UpdateTimes")]
[HttpPut]
public bool UpdateTimes(List<Time> times)
{
return true;
}