ASP.NET Core 3.1 get method body breaks the request

Issue happened on ASP.NET Core 3.1 Web API controller. I have a method in controller with [HttpGet] attribute and [FromBody] for only parameter: [HttpGet] public async Task<ActionResult> GetMessages([FromBody] MessageRM messagesRequest) This method expects to receive a request model: public class MessageRM { public int RegionID { get; set; } public int? LastMessageID { get; set; … Read more

How can ModelState be accessed in HttpPut if it is only created in HttpPost?

“The ModelState represents a collection of name and value pairs that were submitted to the server during a POST.” That is the best definition I have found for the ModelState property. So I have some code using a web api that Creates a customer and Updates a customer, and my question is, since I have accessed ModelState in CreateCustomer, wont the ModelState always be not valid if I hadnt already submitted a Post request with CreateCustomer? Or is the ModelState updated with both PUT and Post requests? Because according to the definition above, the ModelState property wont be initialized until I create a customer, and in my UpdateCustomer method, I need to check if the customer object given in the parameters is the one that is valid, not any Model that was submitted to the server during a different POST request.