/// <summary> /// /// </summary> /// <returns></returns> public ActionResult Index(int page = 1, string searchValue = "", string categoryId = "", string supplierId = "") { List <Product> data = new List <Product>(); try { data = CatalogBLL.Product_List(page, AppSettings.DefaultPageSize, searchValue, categoryId, supplierId); } catch (Exception e) { return(RedirectToAction("Index")); } var model = new Models.ProductPaginationResult() { Page = page, PageSize = AppSettings.DefaultPageSize, RowCount = CatalogBLL.Product_Count(searchValue, categoryId, supplierId), Data = data, SearchValue = searchValue, CategoryID = categoryId, SupplierID = supplierId }; return(View(model)); }
public ActionResult Index(int page = 1, string searchValue = "", int categoryName = 0, int companyName = 0) { var model = new Models.ProductPaginationResult() { Page = page, PageSize = AppSetting.DefaultPageSize, RowCount = CatalogBLL.Product_Count(searchValue, categoryName, companyName), Data = CatalogBLL.Product_List(page, AppSetting.DefaultPageSize, searchValue, categoryName, companyName), searchValue = searchValue, categoryName = categoryName, companyName = companyName, }; return(View(model)); }
// GET: Product public ActionResult Index(int page = 1, string searchValue = "") { int pageSize = 10; int rowCount = 0; List <Product> listOfProduct = CatelogBLL.ListOfProduct(page, pageSize, searchValue, out rowCount); var model = new Models.ProductPaginationResult() { Page = page, PageSize = pageSize, RowCount = rowCount, SearchValue = searchValue, Data = listOfProduct }; 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)); }
/// <summary> /// Quản lý sản phẩm /// </summary> /// <returns></returns> public ActionResult Index(int page = 1, string searchValue = "", string categoryId = "0", string supplierId = "0") { var model = new Models.ProductPaginationResult() { Page = page, PageSize = AppSettings.DefaultPageSize, RowCount = CatalogBLL.Product_Count(searchValue, categoryId, supplierId), SearchValue = searchValue, Category = categoryId, Supplier = categoryId, Data = CatalogBLL.Product_List(page, AppSettings.DefaultPageSize, searchValue, Convert.ToInt32(categoryId), Convert.ToInt32(supplierId)) }; //ViewData["Category"] = CatalogBLL.Category_List(1, CatalogBLL.Category_Count(""), ""); //ViewData["Supplier"] = CatalogBLL.Supplier_List(1, CatalogBLL.Supplier_Count(""), ""); return(View(model)); }
// GET: Products public ActionResult Index(int page = 1, string searchValue = "", int supplier = 0, int category = 0) { int pageSize = 3; int rowCount = 0; List <Product> ListOfProduct = CatalogBLL.ListOfProducts(page, pageSize, searchValue, out rowCount, supplier, category); var model = new Models.ProductPaginationResult() { Page = page, PageSize = pageSize, RowCount = rowCount, SearchValue = searchValue, Category = category.ToString(), Supplier = supplier.ToString(), Data = ListOfProduct }; return(View(model)); }
// GET: Product public ActionResult Index(int page = 1, string searchValue = "", int CategoryID = 0, int SupplierID = 0) { var model = new Models.ProductPaginationResult() { SearchValue = searchValue, CategoryID = CategoryID, SupplierID = SupplierID, Page = page, PageSize = AppSettings.DefaultPagesize, RowCount = CatalogBLL.Products_Count(searchValue, CategoryID, SupplierID), Data = CatalogBLL.Products_List(page, AppSettings.DefaultPagesize, searchValue, CategoryID, SupplierID) }; //var listofSuppliers = CatalogBLL.Suppliers_List(page, 10, searchValue); //int rowcount = CatalogBLL.Supplier_count(searchValue); //ViewBag.Count = rowcount; return(View(model)); }
public ActionResult Index(string category = "", string supplier = "", string searchValue = "", int page = 1) { int pageSize = 10; int rowCount = 0; //Muốn sử dụng out bắt buộc phải chỉ định giá trị trước khi sử dụng List <Product> listOfProduct = CatalogBLL.ListOfProducts(page, pageSize, searchValue, out rowCount, category, supplier); var model = new Models.ProductPaginationResult() { Page = page, PageSize = pageSize, RowCount = rowCount, SearchValue = searchValue, Category = category, Supplier = supplier, Data = listOfProduct }; return(View(model)); }
/// <summary> /// /// </summary> /// <returns></returns> /// public ActionResult Index(string Category = "", string Supplier = "", string SeachValue = "", int page = 1) { int pageSize = 5; int rowCount = 0; // Class CatalogBLL is static => dont need new instance class List <Product> listOfProduct = CatalogBLL.ListOfProducts(page, pageSize, SeachValue, out rowCount, Category, Supplier); // class ProductPaginationResult is normar class => must be new instance Models.ProductPaginationResult model = new Models.ProductPaginationResult() { Page = page, PageSize = pageSize, RowCount = rowCount, SeachValue = SeachValue, Category = Category, Supplier = Supplier, Data = listOfProduct }; return(View(model)); }
/// <summary> /// View page: List of products /// </summary> /// <param name="page"></param> /// <param name="searchValue"></param> /// <param name="category"></param> /// <param name="supplier"></param> /// <returns></returns> public IActionResult Index(int page = 1, string searchValue = "", string category = "", string supplier = "") { int rowCount = 0; int pageSize = 10; List <Product> listOfProduct = CatalogBLL.ListOfProduct(page, pageSize, searchValue ?? "", out rowCount, category, supplier); var model = new Models.ProductPaginationResult() { Page = page, Data = listOfProduct, PageSize = pageSize, RowCount = rowCount, SearchValue = searchValue, SelectedCategory = category, SelectedSupplier = supplier, }; return(View(model)); }
// GET: Product /// <summary> /// trang chủ của sản phẩm /// </summary> /// <returns></returns> public ActionResult Index(int page = 1, string searchValue = "", int category = 1, int supplier = 1) { int pageSize = 3; int rowCount = 0; List <Product> listOfProduct = CataLogBLL.ListOfProduct(page, pageSize, searchValue, out rowCount, supplier, category); var model = new Models.ProductPaginationResult() { Page = page, PageSize = pageSize, RowCount = rowCount, Data = listOfProduct, SearchValue = searchValue, Supplier = CataLogBLL.GetSupplier(supplier), Category = CataLogBLL.GetCategory(category) // Attribute = CataLogBLL.GetAttribute() }; // int pagesize = 3; // int rowcount = 0; // list<supplier> model = catalogbll.listofsupplier(page, pagesize, searchvalue, out rowcount); // viewbag.rowcount = rowcount; return(View(model)); }