Facebook
From www, 2 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 55
  1.  public class FlightDALStub : IFetchDal<FlightDto>, IPersistDal<FlightDto>
  2.     {
  3.         private readonly Dictionary<long, FlightDto> data;
  4.         public void delete(int id)
  5.         {
  6.             data.Remove(id);        
  7.         }
  8.  
  9.         public IEnumerable<FlightDto> getAll() => data.Values;
  10.         public FlightDto? getById(int id) => data.GetValueOrDefault(id);
  11.  
  12.         public void save(FlightDto flight)
  13.         {
  14.             data[flight.flightId] = new FlightDto
  15.             {
  16.                 flightId = flight.flightId,
  17.                 aircraftCode = flight.aircraftCode,
  18.                 aircraftType = flight.aircraftType,
  19.                 departureCountry = flight.departureCountry,
  20.                 arrivalCountry = flight.arrivalCountry,
  21.                 departureDate = flight.departureDate,
  22.                 arrivalDate = flight.arrivalDate,
  23.                 flightStatus = flight.flightStatus,
  24.                 price = flight.price
  25.             };
  26.         }
  27.  
  28.         public int saveGetId(FlightDto t)
  29.         {
  30.             throw new NotImplementedException();
  31.         }
  32.  
  33.         public IEnumerable<FlightDto> search(string searchString)
  34.         {
  35.             throw new NotImplementedException();
  36.         }
  37.  
  38.         public void update(FlightDto flight)
  39.         {
  40.             data[flight.flightId] = new FlightDto
  41.             {
  42.                 flightId = flight.flightId,
  43.                 aircraftCode = flight.aircraftCode,
  44.                 aircraftType = flight.aircraftType,
  45.                 departureCountry = flight.departureCountry,
  46.                 arrivalCountry = flight.arrivalCountry,
  47.                 departureDate = flight.departureDate,
  48.                 arrivalDate = flight.arrivalDate,
  49.                 flightStatus = flight.flightStatus,
  50.                 price = flight.price
  51.             };
  52.         }
  53.  
  54.         public FlightDto verifyLogin(string email, string password)
  55.         {
  56.             throw new NotImplementedException();
  57.         }
  58.     }
  59.    
  60.      public class FlightDALStub : IFetchDal<FlightDto>, IPersistDal<FlightDto>
  61.     {
  62.         private readonly Dictionary<long, FlightDto> data;
  63.         public void delete(int id)
  64.         {
  65.             data.Remove(id);        
  66.         }
  67.  
  68.         public IEnumerable<FlightDto> getAll() => data.Values;
  69.         public FlightDto? getById(int id) => data.GetValueOrDefault(id);
  70.  
  71.         public void save(FlightDto flight)
  72.         {
  73.             data[flight.flightId] = new FlightDto
  74.             {
  75.                 flightId = flight.flightId,
  76.                 aircraftCode = flight.aircraftCode,
  77.                 aircraftType = flight.aircraftType,
  78.                 departureCountry = flight.departureCountry,
  79.                 arrivalCountry = flight.arrivalCountry,
  80.                 departureDate = flight.departureDate,
  81.                 arrivalDate = flight.arrivalDate,
  82.                 flightStatus = flight.flightStatus,
  83.                 price = flight.price
  84.             };
  85.         }
  86.  
  87.         public int saveGetId(FlightDto t)
  88.         {
  89.             throw new NotImplementedException();
  90.         }
  91.  
  92.         public IEnumerable<FlightDto> search(string searchString)
  93.         {
  94.             throw new NotImplementedException();
  95.         }
  96.  
  97.         public void update(FlightDto flight)
  98.         {
  99.             data[flight.flightId] = new FlightDto
  100.             {
  101.                 flightId = flight.flightId,
  102.                 aircraftCode = flight.aircraftCode,
  103.                 aircraftType = flight.aircraftType,
  104.                 departureCountry = flight.departureCountry,
  105.                 arrivalCountry = flight.arrivalCountry,
  106.                 departureDate = flight.departureDate,
  107.                 arrivalDate = flight.arrivalDate,
  108.                 flightStatus = flight.flightStatus,
  109.                 price = flight.price
  110.             };
  111.         }
  112.  
  113.         public FlightDto verifyLogin(string email, string password)
  114.         {
  115.             throw new NotImplementedException();
  116.         }
  117.     }