public async Task <IList <Rental> > Handle(GetAllRentalsQuery query,
                                                   CancellationToken cancellationToken)
        {
            var entities = await _unitOfWork.RentalRepository.GetAllAsync(cancellationToken);

            return(entities);
        }
        public List <RentalResult> Execute(GetAllRentalsQuery query)
        {
            var rentals = _unitOfWork.RentalReadModel.GetAll();

            var rentalsToReturn = _mapper.Map <List <RentalResult> >(rentals);

            return(rentalsToReturn);
        }
예제 #3
0
        public ActionResult <List <RentalResult> > GetRentals()
        {
            var query = new GetAllRentalsQuery();

            var result = _queryDispatcher.Send <GetAllRentalsQuery, List <RentalResult> >(query);

            if (result == null)
            {
                return(NotFound());
            }

            return(Ok(result));
        }