public FlightDetail PurchaseTicket(int flightId) { var flight = _flightRepository.Get().FirstOrDefault(x => x.Id == flightId); int soldSeat = flight.SoldSeats; if (flight.SoldSeats <= flight.Seats) { flight.SoldSeats = soldSeat + 1; } var ticketoffice = _ticketOfficeRepository.Get().FirstOrDefault(x => x.FlightID == flightId); PromotionSales promotionsale = new PromotionSales(ticketoffice); var ticket = GetFlightDetail(flightId).FirstOrDefault(); ticket.Cost = promotionsale.CheckDiscounts(); return(ticket); }
public FlightDetail PurchaseTicket(int flightId) { var flight = _flightRepository.Get().FirstOrDefault(x => x.Id == flightId); int soldSeat = flight.SoldSeats; if (flight.SoldSeats <= flight.Seats ) { flight.SoldSeats = soldSeat + 1; } var ticketoffice = _ticketOfficeRepository.Get().FirstOrDefault(x => x.FlightID == flightId); PromotionSales promotionsale = new PromotionSales(ticketoffice); var ticket = GetFlightDetail(flightId).FirstOrDefault(); ticket.Cost = promotionsale.CheckDiscounts(); return ticket; }