Exemplo n.º 1
0
        public ActionResult Index(int page = 1, string searchValue = "")
        {
            var model = new Models.CategoryPaginationResult()
            {
                Page        = page,
                PageSize    = AppSettings.DefaultPageSize,
                RowCount    = CatalogBLL.Category_Count(searchValue),
                Data        = CatalogBLL.Categorys_List(page, AppSettings.DefaultPageSize, searchValue),
                searchValue = searchValue
            };

            return(View(model));
        }
        public ActionResult Index(int page = 1, string searchValue = "", int category = 0, int supplier = 0)
        {
            var model = new Models.ProductPaginationResult()
            {
                Page     = page,
                PageSize = AppSettings.DefaultPageSize,
                RowCount = CatalogBLL.Product_Count(searchValue, category, supplier),
                Data     = CatalogBLL.Products_List(page, AppSettings.DefaultPageSize, searchValue, category, supplier),
                Category = category,
                Supplier = supplier
            };

            ViewData["Category"] = CatalogBLL.Categorys_List(1, CatalogBLL.Category_Count(""), "");
            ViewData["Supplier"] = CatalogBLL.Suppliers_List(1, CatalogBLL.Supplier_Count(""), "");
            return(View(model));
        }
        public static List <SelectListItem> Category(bool allowSelectAll = true)
        {
            List <SelectListItem> list = new List <SelectListItem>();

            if (allowSelectAll)
            {
                list.Add(new SelectListItem()
                {
                    Value = "0", Text = "-- All Categories --"
                });
            }
            foreach (var category in CatalogBLL.Categorys_List(1, CatalogBLL.Category_Count(""), ""))
            {
                list.Add(new SelectListItem()
                {
                    Value = category.CategoryID.ToString(),
                    Text  = category.CategoryName
                });
            }
            return(list);
        }