예제 #1
0
        public ResponseDto <ProductFilterListSummaryDto> GetListSummary(ProductFilterGetListCriteriaDto criteriaDto)
        {
            ProductFilterGetListCriteriaBo criteriaBo = new ProductFilterGetListCriteriaBo()
            {
                SearchWord        = criteriaDto.SearchWord,
                ProductCategoryId = criteriaDto.ProductCategoryId,
                PropertyList      = criteriaDto.PropertyList,

                MinPrice = criteriaDto.MinPrice,
                MaxPrice = criteriaDto.MaxPrice,

                Session = Session
            };

            ResponseBo <ProductFilterListSummaryBo> responseBo = productFilterBusiness.GetListSummary(criteriaBo);

            ResponseDto <ProductFilterListSummaryDto> responseDto = responseBo.ToResponseDto <ProductFilterListSummaryDto, ProductFilterListSummaryBo>();

            if (responseBo.IsSuccess && responseBo.Bo != null)
            {
                responseDto.Dto = new ProductFilterListSummaryDto();

                responseDto.Dto.Count    = responseBo.Bo.Count;
                responseDto.Dto.PageSize = responseBo.Bo.PageSize;

                if (responseBo.Bo.PropertyList != null)
                {
                    responseDto.Dto.PropertyList = responseBo.Bo.PropertyList.
                                                   GroupBy(x => x.GroupId).Select(x => x.First()).
                                                   Select(
                        x => new PropertyListDto()
                    {
                        Id           = x.GroupId,
                        Name         = x.GroupName,
                        UrlName      = x.GroupUrlName,
                        PropertyList = responseBo.Bo.PropertyList.Where(y => y.GroupId == x.GroupId).Select(
                            y => new PropertyListDto()
                        {
                            Id      = y.PropertyId,
                            Name    = y.PropertyName,
                            UrlName = y.PropertyUrlName,
                            Count   = y.PropertyCount
                        }).ToList()
                    }).ToList();

                    //responseDto.Dto.PropertyCountList = new List<ProductFilterListCountDto>();
                    //foreach (PropertyListBo item in responseBo.Bo.PropertyList)
                    //{
                    //    responseDto.Dto.PropertyCountList.Add(new ProductFilterListCountDto()
                    //    {
                    //        PropertyId = item.PropertyId,
                    //        Cnt = item.Cnt
                    //    });
                    //}
                }
            }

            return(responseDto);
        }
예제 #2
0
        public ResponseDto <List <ProductFilterListDto> > GetList(ProductFilterGetListCriteriaDto criteriaDto)
        {
            ProductFilterGetListCriteriaBo criteriaBo = new ProductFilterGetListCriteriaBo()
            {
                SearchWord        = criteriaDto.SearchWord,
                ProductCategoryId = criteriaDto.ProductCategoryId,
                PropertyList      = criteriaDto.PropertyList,
                MinPrice          = criteriaDto.MinPrice,

                MaxPrice = criteriaDto.MaxPrice,

                PageNumber = criteriaDto.PageNumber,

                Session = Session
            };

            ResponseBo <List <ProductFilterListBo> > responseBo = productFilterBusiness.GetList(criteriaBo);

            ResponseDto <List <ProductFilterListDto> > responseDto = responseBo.ToResponseDto <List <ProductFilterListDto>, List <ProductFilterListBo> >();

            if (responseBo.IsSuccess && responseBo.Bo != null)
            {
                responseDto.Dto = new List <ProductFilterListDto>();
                foreach (ProductFilterListBo itemBo in responseBo.Bo)
                {
                    responseDto.Dto.Add(new ProductFilterListDto()
                    {
                        PersonProductId = itemBo.PersonProductId,
                        OnlineSalePrice = itemBo.OnlineSalePrice,

                        StarCount = itemBo.StarCount,
                        StarSum   = itemBo.StarSum,

                        Notes = itemBo.Notes,

                        ProductId     = itemBo.ProductId,
                        ProductName   = itemBo.ProductName,
                        ProductTypeId = itemBo.ProductTypeId,

                        ShopId        = itemBo.ShopId,
                        ShopFullName  = itemBo.ShopFullName,
                        ShopUrlName   = itemBo.ShopUrlName,
                        ShopStarCount = itemBo.ShopStarCount,
                        ShopStarSum   = itemBo.ShopStarSum,
                        ShopTypeName  = itemBo.ShopTypeName
                    });
                }
            }

            return(responseDto);
        }