public async Task<IActionResult> PutCar([FromRoute] int id, [FromBody] Car car) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != car.CarId) { return BadRequest(); } _context.Entry(car).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CarExists(id)) { return NotFound(); } else { throw; } } return NoContent(); }
public async Task <IActionResult> PutCcompany([FromRoute] int id, [FromBody] Ccompany ccompany) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != ccompany.CmpId) { return(BadRequest()); } _context.Entry(ccompany).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CcompanyExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutCarBooking([FromRoute] int id, [FromBody] CarBooking carBooking) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != carBooking.BookingId) { return(BadRequest()); } _context.Entry(carBooking).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException uex) { if (!CarBookingExists(id)) { return(NotFound()); } else { throw uex; } } catch (Exception ex) { Console.WriteLine(ex); } return(NoContent()); }