public async Task <IActionResult> PutVille([FromRoute] Guid id, [FromBody] Ville ville) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != ville.IdVille) { return(BadRequest()); } _context.Entry(ville).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!VilleExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutUtilisateur([FromRoute] Guid id, [FromBody] Utilisateur utilisateur) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != utilisateur.IdUser) { return(BadRequest()); } _context.Entry(utilisateur).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UtilisateurExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }