I am trying to send array of object to web Api post ActionResult method
my array of objects looks like this
model:[{"Status":"HOLD","MessageId":1},{"Status":"HOLD","MessageId":2}]
post request from front-end in .cshtml file
$.ajax({
method: 'post',
url: "Home/postMessage",
data: JSON.stringify(model),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
console.log(data)
}
});
web api code looks like this
PostStatus model
public class PostStatus
{
public string Status { get; set; }
public int MessageId { get; set; }
}
post Request code in controller
[HttpPost]
public ActionResult postMessage(PostStatus model)
{
return Json(new { data = model });
}
debugging snip of above web api post request code
I WAS UNABLE FIND THE ISSUE WHERE IT WAS CAUSING THE PROBLEM.
