Пример #1
0
        public async Task <IActionResult> Index(string categoryname, string search, int productPage = 1, int PageSize = 20, string orderBy = "LP")
        {
            if (productPage <= 1)
            {
                productPage = 1;
            }
            if (PageSize <= 0)
            {
                PageSize = 20;
            }
            if (search == null)
            {
                search = "";
            }
            var items = await _productService.GetOneCategoriesProductsDTOAsync(categoryname);

            PagingInfo info = new PagingInfo()
            {
                ItemsPerPage = PageSize,
                CurrentPage  = productPage,
                Search       = search,
                CategoryName = categoryname,
                OrderBy      = orderBy
            };

            ProductsPagingViewModel Vm = new ProductsPagingViewModel()
            {
                Products   = items,
                PagingInfo = info
            };

            //ViewBag.Search = search;
            return(View(Vm));
        }
Пример #2
0
        public BuildingMaterialsController(ApplicationDbContext db)
        {
            _db = db;
            productsPagingVM = new ProductsPagingViewModel()
            {
                Products = new List <Products>(),

                SpecialTags = new List <SpecialTags>(),
                SelectedTag = 0,
                Quantity    = 0,
                Id          = 0
            };
        }