public async Task <IActionResult> PutAnnonce(int id, [FromBody] Annonce annonce) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != annonce.Id) { return(BadRequest()); } _context.Entry(annonce).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AnnonceExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task UpdateAsync(Annonce annonce) { context.Entry(annonce).State = EntityState.Modified; await context.SaveChangesAsync(); }