public async Task <IActionResult> PutVoir(string id, Voir voir) { if (id != voir.Id) { return(BadRequest()); } _context.Entry(voir).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!VoirExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <Voir> > PostVoir(Voir voir) { _context.Voir.Add(voir); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (VoirExists(voir.Id)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetVoir", new { id = voir.Id }, voir)); }