public PartialViewResult _CategoryList(string keyText = "", int pageNumber = 1, int pageSize = 10) { List <TB_CATEGORIES> list = new List <TB_CATEGORIES>(); int count = 0; try { keyText = keyText.Trim(); list = Categories_Service.GetAll() .Where(x => string.IsNullOrEmpty(keyText) || x.CategoryCode.IndexOf(keyText) >= 0 || x.CategoryName.IndexOf(keyText) >= 0) .ToList(); count = list.Count; list = list .Skip((pageNumber - 1) * pageSize).Take(pageSize) .ToList(); } catch (Exception ex) { CORE.Helpers.IOHelper.WriteLog(StartUpPath, IpAddress, "Products/_CategoryList :", ex.Message, ex.ToString()); } ViewBag.maxNumber = Math.Ceiling((double)count / pageSize); ViewBag.pageNumber = pageNumber; ViewBag.pageSize = pageSize; return(PartialView(list)); }
public PartialViewResult _ChiTiet(string productId = "") { int height = (int)(Request.Browser.ScreenPixelsHeight * 0.85); TB_PRODUCTS s = Products_Service.GetById(productId); ViewBag.Product = s; List <TB_SUPPLIERS> list = Suppliers_Service.GetAll() .Where(x => x.SupplierState == "A").ToList(); ViewBag.SupplierList = list; List <TB_CATEGORIES> list2 = Categories_Service.GetAll() .Where(x => x.CategoryState == "A").ToList(); ViewBag.CategoryList = list2; try { ViewBag.Images = Files_Service.GetByRefecense("" + s.ProductCode).Where(x => x.FileType == "PRODUCT").ToList(); } catch (Exception ex) { CORE.Helpers.IOHelper.WriteLog(StartUpPath, IpAddress, "Blogs/_List :", ex.Message, ex.ToString()); } return(PartialView(height)); }
public ActionResult Search(string group = "", string key = "") { List <TB_CATEGORIES> catList = Categories_Service.GetAll(); ViewBag.CatList = catList; ViewBag.Group = group; List <TB_PRODUCTS> productList = Products_Service.GetAll().Where(x => x.ProductName.IndexOf(key) > -1).ToList(); ViewBag.ProductList = productList; List <TB_FILES> file = Files_Service.GetAll().Where(x => x.FileType == "PRODUCT").ToList(); if (file == null) { file = new List <TB_FILES>(); } ViewBag.Files = file; return(View()); }