public async Task <IActionResult> PutImage([FromRoute] int id, [FromBody] Image image) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != image.ImageId) { return(BadRequest()); } _context.Entry(image).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ImageExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }