public async Task <ActionResult <DemandeAvance> > PostDemandeAvance(DemandeAvance demandeAvance) { _context.demandeAvances.Add(demandeAvance); await _context.SaveChangesAsync(); return(CreatedAtAction("GetDemandeAvance", new { id = demandeAvance.Id }, demandeAvance)); }
public async Task <IActionResult> PutDemandeAvance(int id, DemandeAvance demandeAvance) { if (id != demandeAvance.Id) { return(BadRequest()); } _context.Entry(demandeAvance).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DemandeAvanceExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }