public ActionResult UpdateAirplane(int TripId, TravelTrip travel) { try { repository.UpdateTrip(TripId, travel); return(Ok("Data is Updated Successfully")); } catch (Exception e) { return(BadRequest(e)); } }
public ActionResult InsertAirplane(TravelTrip travel) { try { repository.InsertData(travel); return(Ok("Data is Inserted Succcessfully")); } catch (Exception e) { return(BadRequest(e)); } }
public void UpdateTrip(int tripid, TravelTrip travel) { var data = context.TravelTrips.SingleOrDefault(s => s.TravelId == tripid); data.DepatureCity = travel.DepatureCity; data.DepatureAirPortName = travel.DepatureAirPortName; data.ArrivedCity = travel.ArrivedCity; data.ArriveAirPortName = travel.ArriveAirPortName; data.DepartDate = travel.DepartDate; data.ArriveDate = travel.ArriveDate; data.DepartTime = travel.DepartTime; data.ArriveTime = travel.ArriveTime; data.AirPlaneId = travel.AirPlaneId; data.CostId = travel.CostId; context.SaveChanges(); }
public void InsertData(TravelTrip travel) { context.TravelTrips.Add(travel); context.SaveChanges(); }