forked from ashishps1/awesome-low-level-design
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAirlineManagementSystem.cs
More file actions
54 lines (46 loc) · 1.56 KB
/
AirlineManagementSystem.cs
File metadata and controls
54 lines (46 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using System;
using System.Collections.Generic;
using System.Linq;
namespace AirlineManagementSystem
{
public class AirlineManagementSystem
{
private readonly List<Flight> flights;
private readonly List<Aircraft> aircrafts;
private readonly FlightSearch flightSearch;
private readonly BookingManager bookingManager;
private readonly PaymentProcessor paymentProcessor;
public AirlineManagementSystem()
{
flights = new List<Flight>();
aircrafts = new List<Aircraft>();
flightSearch = new FlightSearch(flights);
bookingManager = BookingManager.Instance;
paymentProcessor = PaymentProcessor.Instance;
}
public void AddFlight(Flight flight)
{
flights.Add(flight);
}
public void AddAircraft(Aircraft aircraft)
{
aircrafts.Add(aircraft);
}
public List<Flight> SearchFlights(string source, string destination, DateTime date)
{
return flightSearch.SearchFlights(source, destination, date);
}
public Booking BookFlight(Flight flight, Passenger passenger, Seat seat, double price)
{
return bookingManager.CreateBooking(flight, passenger, seat, price);
}
public void CancelBooking(string bookingNumber)
{
bookingManager.CancelBooking(bookingNumber);
}
public void ProcessPayment(Payment payment)
{
paymentProcessor.ProcessPayment(payment);
}
}
}