示例#1
0
 public bool AddFlightSection(FlightSection sectionToAdd)
 {
     foreach (FlightSection section in sections)
     {
         if (sectionToAdd.SeatClass.Equals(section.SeatClass))
         {
             throw new Exception(ExceptionHelper.ExistingSection);
         }
     }
     sections.Add(sectionToAdd);
     return(true);
 }
示例#2
0
 public void CreateSection(string aName, string flightId, int rows, int cols, SeatClass s)
 {
     try
     {
         Airline       airline = _airlineRepository.Retreive(aName);
         Flight        flight  = airline.Flights.Retreive(flightId);
         FlightSection section = new FlightSection(s, rows, cols);
         if (airline == null)
         {
             throw new Exception(ExceptionHelper.NonExistentAirline);
         }
         if (flight == null)
         {
             throw new Exception(ExceptionHelper.FlightNotFound);
         }
         flight.AddFlightSection(section);
     }
     catch (Exception e)
     {
         Console.WriteLine($"{e.Message} - {aName}");
     }
 }