public async Task <IActionResult> PutRoleDonVi([FromRoute] int id, [FromBody] RoleDonVi roledonvi) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != roledonvi.RoleDonViId) { return(BadRequest()); } _context.Entry(roledonvi).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RoleDonViExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostRoleDonVi([FromBody] RoleDonVi roledonvi) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.RoleDonVis.Add(roledonvi); await _context.SaveChangesAsync(); return(CreatedAtAction("GetRoleDonVi", new { id = roledonvi.RoleDonViId }, roledonvi)); }