示例#1
0
 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."
     });
 }
示例#2
0
        public static TripModel CreateNewFlight()
        {
            AddFlight NF = new AddFlight();

            NF.ShowDialog();
            if (NF.DialogResult == true)
            {
                SaveNewFlight(NewFlight);
                return(NewFlight);
            }
            else
            {
                return(null);
            }
        }