- public class FlightDALStub : IFetchDal<FlightDto>, IPersistDal<FlightDto>
- {
- private readonly Dictionary<long, FlightDto> data;
- public void delete(int id)
- {
- data.Remove(id);
- }
- public IEnumerable<FlightDto> getAll() => data.Values;
- public FlightDto? getById(int id) => data.GetValueOrDefault(id);
- public void save(FlightDto flight)
- {
- data[flight.flightId] = new FlightDto
- {
- flightId = flight.flightId,
- aircraftCode = flight.aircraftCode,
- aircraftType = flight.aircraftType,
- departureCountry = flight.departureCountry,
- arrivalCountry = flight.arrivalCountry,
- departureDate = flight.departureDate,
- arrivalDate = flight.arrivalDate,
- flightStatus = flight.flightStatus,
- price = flight.price
- };
- }
- public int saveGetId(FlightDto t)
- {
- throw new NotImplementedException();
- }
- public IEnumerable<FlightDto> search(string searchString)
- {
- throw new NotImplementedException();
- }
- public void update(FlightDto flight)
- {
- data[flight.flightId] = new FlightDto
- {
- flightId = flight.flightId,
- aircraftCode = flight.aircraftCode,
- aircraftType = flight.aircraftType,
- departureCountry = flight.departureCountry,
- arrivalCountry = flight.arrivalCountry,
- departureDate = flight.departureDate,
- arrivalDate = flight.arrivalDate,
- flightStatus = flight.flightStatus,
- price = flight.price
- };
- }
- public FlightDto verifyLogin(string email, string password)
- {
- throw new NotImplementedException();
- }
- }
- public class FlightDALStub : IFetchDal<FlightDto>, IPersistDal<FlightDto>
- {
- private readonly Dictionary<long, FlightDto> data;
- public void delete(int id)
- {
- data.Remove(id);
- }
- public IEnumerable<FlightDto> getAll() => data.Values;
- public FlightDto? getById(int id) => data.GetValueOrDefault(id);
- public void save(FlightDto flight)
- {
- data[flight.flightId] = new FlightDto
- {
- flightId = flight.flightId,
- aircraftCode = flight.aircraftCode,
- aircraftType = flight.aircraftType,
- departureCountry = flight.departureCountry,
- arrivalCountry = flight.arrivalCountry,
- departureDate = flight.departureDate,
- arrivalDate = flight.arrivalDate,
- flightStatus = flight.flightStatus,
- price = flight.price
- };
- }
- public int saveGetId(FlightDto t)
- {
- throw new NotImplementedException();
- }
- public IEnumerable<FlightDto> search(string searchString)
- {
- throw new NotImplementedException();
- }
- public void update(FlightDto flight)
- {
- data[flight.flightId] = new FlightDto
- {
- flightId = flight.flightId,
- aircraftCode = flight.aircraftCode,
- aircraftType = flight.aircraftType,
- departureCountry = flight.departureCountry,
- arrivalCountry = flight.arrivalCountry,
- departureDate = flight.departureDate,
- arrivalDate = flight.arrivalDate,
- flightStatus = flight.flightStatus,
- price = flight.price
- };
- }
- public FlightDto verifyLogin(string email, string password)
- {
- throw new NotImplementedException();
- }
- }