public object createflight(AddFlight Lvm) { try { FRSEntities db = new FRSEntities(); Flight Ru = new Flight(); if (Ru.FlightID == 0) { Ru.SourceFlight = Lvm.SourceFlight; Ru.Destination = Lvm.Destination; Ru.ArrivalTime = Lvm.ArrivalTime; Ru.DepartureTime = Lvm.DepartureTime; Ru.NoOfSeats = Lvm.NoOfSeats; Ru.FlightDate = Lvm.FlightDate; Ru.Duration = Lvm.Duration; Ru.Del = 1; Ru.SeatAvailability = 60; db.Flights.Add(Ru); db.SaveChanges(); return(new Response { Status = "Success", Message = "SuccessFully Saved." }); } } catch (Exception) { throw; } return(new Response { Status = "Error", Message = "Invalid Data." }); }
public static TripModel CreateNewFlight() { AddFlight NF = new AddFlight(); NF.ShowDialog(); if (NF.DialogResult == true) { SaveNewFlight(NewFlight); return(NewFlight); } else { return(null); } }