Example #1
0
 public static int GetCargo(string flightId)
 {
     lock (RegistrationLists)
     {
         RegistrationList list = RegistrationLists.Find(x => x.FlightId.Equals(flightId));
         return(list != null ? list.CargoCount : -1);
     }
 }
Example #2
0
 public static List <string> GetPassengers(string flightId)
 {
     lock (RegistrationLists)
     {
         RegistrationList list = RegistrationLists.Find(x => x.FlightId.Equals(flightId));
         return(list != null ? list.Passengers : new List <string>());
     }
 }
Example #3
0
 public static bool Register(string flightId, string passengerId, int cargoCount)
 {
     lock (RegistrationLists)
     {
         RegistrationList list = RegistrationLists.Find(x => x.FlightId.Equals(flightId));
         return(list != null && list.Register(passengerId, cargoCount));
     }
 }
Example #4
0
 public static void CloseRegistration(string flightId)
 {
     lock (RegistrationLists)
     {
         RegistrationList list = RegistrationLists.Find(x => x.FlightId.Equals(flightId));
         if (list == null)
         {
             return;
         }
         list.IsRegistrationOpened = false;
     }
 }
Example #5
0
 public static void OpenRegistration(string flightId)
 {
     lock (RegistrationLists)
     {
         RegistrationList list = RegistrationLists.Find(x => x.FlightId.Equals(flightId));
         if (list == null)
         {
             RegistrationLists.Add(new RegistrationList(flightId));
         }
         else
         {
             list.IsRegistrationOpened = true;
         }
     }
 }