public async Task <IActionResult> PutCompanyAbout(int id, [FromBody] CompanyAbout companyAbout) { //if (id != companyAbout.AvioCompID) //{ // return BadRequest(); //} _context.Entry(companyAbout).State = EntityState.Modified; var ca = _context.CompanyAbout.FirstOrDefault(x => x.AvioCompID == companyAbout.AvioCompID); ca.CompanyFlights = companyAbout.CompanyFlights; foreach (var item in ca.CompanyFlights) { _context.Entry(item).State = item.FlightID == 0 ? EntityState.Added : EntityState.Modified; } try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CompanyAboutExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutFriends(int id, [FromBody] Friends friends) { if (id != friends.Id) { return(BadRequest()); } _context.Entry(friends).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FriendsExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutflightRate(int id, flightRate flightRate) { if (id != flightRate.RateIdd) { return(BadRequest()); } _context.Entry(flightRate).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!flightRateExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutFlightInfo(string id, FlightInfo flightInfo) { if (id != flightInfo.FlightID) { return(BadRequest()); } _context.Entry(flightInfo).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FlightInfoExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutSeat(int id, Seat seat) { if (id != seat.Id) { return(BadRequest()); } _context.Entry(seat).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SeatExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }