Esempio n. 1
0
        public async Task <Unit> Handle(CreatePassengerBookingProposalCommand request, CancellationToken cancellationToken)
        {
            var dailyRoute = await _dailyRouteRepository.GetOrFailAsync(request.DailyRouteId);

            dailyRoute.AddPassengerBookingProposal(DateTime.Now, Guid.NewGuid(), request.UserId, request.SeatsQuantity);
            await _dailyRouteRepository.UpdateAsync(dailyRoute);

            return(Unit.Value);
        }
Esempio n. 2
0
        public async Task <Unit> Handle(RejectedPassengerBookingCommand request, CancellationToken cancellationToken)
        {
            var proposal = await _passengerBookingProposalRepository.GetOrFailAsync(request.ProposalId);

            var dailyRoute = await _dailyRouteRepository.GetOrFailAsync(proposal.DailyRouteId);

            dailyRoute.RejectedPassengerBookingProposal(request.RejectedReason, request.ProposalId);
            await _dailyRouteRepository.UpdateAsync(dailyRoute);

            return(Unit.Value);;
        }