Example #1
0
        public void Execute(long flightId, long passengerId)
        {
            var flight = flightRepository.GetById(flightId)
                         ?? throw new FlightNotFoundException(flightId);

            var baggage = baggageRepository.Get(flightId, passengerId)
                          ?? throw new BaggageNotFoundException(flightId, passengerId);

            flight.CheckIn(baggage);

            flightRepository.Save(flight);
        }
Example #2
0
        public Guid Execute(long flightId, long passengerId, RegisterPassengerBagRequest passengerBagRequest)
        {
            var baggage = checkedInBaggageRepository.Get(flightId, passengerId)
                          ?? throw new BaggageNotFoundException(flightId, passengerId);

            var bagDto = passengerBagRequest.Bag;

            var bagGuid = baggage.CheckIn(bagDto.Weight);

            checkedInBaggageRepository.Save(baggage);

            return(bagGuid);
        }