public async Task <IActionResult> PutTaxi([FromRoute] int id, [FromBody] Taxi taxi) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != taxi.TaxiId) { return(BadRequest()); } _context.Entry(taxi).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TaxiExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutAirBooking([FromRoute] int id, [FromBody] AirBooking airBooking) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != airBooking.BookingId) { return(BadRequest()); } _context.Entry(airBooking).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException uex) { if (!AirBookingExists(id)) { return(NotFound()); } else { throw uex; } } catch (Exception ex) { Console.WriteLine(ex); } return(NoContent()); }