Ejemplo n.º 1
0
        public async Task <PrintingEditionResponseModel> FilterAsync(PrintingEditionsRequestModel printingEditionRequestModel)
        {
            var printingEditionRequestDataModel  = PrintingEditionRequestMapper.Map(printingEditionRequestModel);
            var printingEditionResponseDataModel = await _printingEditionRepository.FilterAsync(printingEditionRequestDataModel);

            var printingEditionResponseModel = PrintingEditionResponseMapper.Map(printingEditionResponseDataModel);

            return(printingEditionResponseModel);
        }
        public static PrintingEditionsRequestDataModel Map(PrintingEditionsRequestModel filterModel)
        {
            if (filterModel is null)
            {
                return(new PrintingEditionsRequestDataModel());
            }

            var filter = new PrintingEditionsRequestDataModel
            {
                MaxPrice     = filterModel.MaxPrice,
                MinPrice     = filterModel.MinPrice,
                SearchString = filterModel.SearchString,
                SortType     = filterModel.SortType,
                Paging       = _pagingMapper.Map(filterModel.Paging)
            };

            foreach (var type in filterModel.Types)
            {
                filter.Types.Add(type);
            }
            return(filter);
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> GetFiltered([FromBody] PrintingEditionsRequestModel printingEditionRequestModel)
        {
            var printingEditionResponseModel = await _printingEditionService.FilterAsync(printingEditionRequestModel);

            return(Ok(printingEditionResponseModel));
        }