示例#1
0
        public ActionResult <IndexViewShopModel> SanPham_Filter(DataShopLoad data)
        {
            decimal pricemax;
            string  NameType;
            int     count;

            if (!string.IsNullOrEmpty(data.Type))
            {
                NameType     = LSPService.LoaiSanPham_GetById(int.Parse(data.Type)).name;
                data.qSearch = null;
            }
            else
            {
                NameType = null;
            }

            var SanPhams = sanPhamService.SanPham_Filter(data.Type, data.qSearch, data.price, data.sort, data.pageIndex, Constants.pageSize, out count, out pricemax);
            var ListSP   = new PaginatedList <SanPhamDto>(SanPhams, count, data.pageIndex, Constants.pageSize);
            // Console.WriteLine(ListSP.TotalPages);
            var indexVSM = new IndexViewShopModel()
            {
                ListSP     = ListSP,
                Type       = data.Type,
                NameType   = NameType,
                qSearch    = data.qSearch,
                sort       = data.sort,
                pricemax   = pricemax,
                price      = data.price,
                pageSize   = Constants.pageSize,
                count      = count,
                Range      = Constants.Range,
                pageIndex  = data.pageIndex,
                TotalPages = ListSP.TotalPages
            };

            return(indexVSM);
        }
 public LoaiSanPhamDto GetLSPDto(int id)
 {
     return(LSPservice.LoaiSanPham_GetById(id));
 }