public async Task <IActionResult> PutDonVi([FromRoute] string id, [FromBody] DonVi donVi) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != donVi.Madonvi) { return(BadRequest()); } _context.Entry(donVi).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DonViExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }