コード例 #1
0
        public async Task <PrintingEditionModel> GetAllAsync(PrintingEditionFilterModel printingEditionFilterModel)
        {
            var printingEditionModel = new PrintingEditionModel();

            var filterModel = printingEditionFilterModel.MapToEFFilterModel();

            var listOfPrintingEditions = await _printingEditionRepository.GetAllPrintingEditions(filterModel);

            if (listOfPrintingEditions.Items == null)
            {
                printingEditionModel.Errors.Add(Constants.Errors.NotFoundPrintingEditionsError);
                return(printingEditionModel);
            }

            printingEditionModel.Counter = listOfPrintingEditions.Counter;

            foreach (var printingEdition in listOfPrintingEditions.Items)
            {
                var item = printingEdition.MapToModel();

                item.Price    = item.Price.ConvertFromUSD(printingEditionFilterModel.Currency);
                item.Currency = printingEditionFilterModel.Currency;

                printingEditionModel.Items.Add(item);
            }

            return(printingEditionModel);
        }