Exemplo n.º 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);
        }
Exemplo n.º 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);
        }