Esempio n. 1
0
        public async Task <GetAllPriceListsResponse> Handle(GetAllPriceListsRequest request, CancellationToken cancellationToken)
        {
            var query = new GetAllPricesQuery()
            {
                LaundryId = request.LaundryId,
                CompanyId = request.AuthenticationCompanyId
            };
            var prices = await this.queryExecutor.Execute(query);

            //if (prices == null)
            //{
            //    return new GetAllPriceListsResponse()
            //    {
            //        Error = new Domain.ErrorHandling.ErrorModel(ErrorType.NotFound)
            //    };
            //}
            var mappedPrices = this.mapper.Map <List <PriceList> >(prices);

            return(new GetAllPriceListsResponse()
            {
                Data = mappedPrices
            });
        }
        public async Task <IList <PriceList> > Handle(GetAllPricesQuery request, CancellationToken cancellationToken)
        {
            var prices = _priceListRepository.QueryAll().ToList();

            return(await Task.FromResult(prices));
        }