I'm new in working with ASP.net. I have problem with POST request. Perhaps my code is wrong, I don't find where !
Postman sends me the error message when I try a post request :
"ExceptionType":"System.Net.Http.UnsupportedMediaTypeException","StackTrace":" à System.Net.Http.HttpContentExtensions.ReadAsAsync[T](HttpContent content, Type type, IEnumerable1 formatters, IFormatterLogger formatterLogger, CancellationToken cancellationToken)\r\n à System.Web.Http.ModelBinding.FormatterParameterBinding.ReadContentAsync(HttpRequestMessage request, Type type, IEnumerable
1 formatters, IFormatterLogger formatterLogger, CancellationToken cancellationToken)"}
Here is my code :
// POST: api/Boooks
[Route("~/api/PostCreate")]
public IHttpActionResult Post([FromBody] Books books)
{
if (!ModelState.IsValid)
return BadRequest("Invalid data.");