public IHttpActionResult PutUserDetails(string id, UserDetail UserDetail) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != UserDetail.UID.ToString()) { return(BadRequest()); } db.Entry(UserDetail).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!UserDetailExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutPassengerDetail(int id, PassengerDetail passengerDetail) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != passengerDetail.PNR) { return(BadRequest()); } db.Entry(passengerDetail).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!PassengerDetailExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutJourneyRoute(int id, JourneyRoute journeyRoute) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != journeyRoute.RouteID) { return(BadRequest()); } db.Entry(journeyRoute).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!JourneyRouteExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutTicket(int id, Ticket ticket) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != ticket.TicketID) { return(BadRequest()); } db.Entry(ticket).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!TicketExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }