public async Task <IActionResult> PutBagage(int id, Bagage bagage) { if (id != bagage.BagageId) { return(BadRequest()); } _context.Entry(bagage).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BagageExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutFlight(int id, Flight flight) { if (id != flight.FLIGHTID) { return(BadRequest()); } _context.Entry(flight).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FlightExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutVol(int id, Vol vol) { if (id != vol.VolId) { return(BadRequest()); } _context.Entry(vol).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!VolExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
protected async Task ValidateVol() { if (VolID != null) { var vol = await _context.Vols.FirstAsync(v => v.VolID == VolID); if (vol == null) { ModelState.AddModelError("vols", "Vol invalid"); } else { Bagage.Vol = vol; } } else { Bagage.Vol = null; _context.Entry(Bagage).Reference(b => b.Vol).IsModified = true; } }