public JsonResult loadData(string brand, int page = 1, int pageSize = 9, int typeid = 1, decimal minP = -1, decimal maxP = -1) { var dao = new CatalogUserDao(); var model = dao.loadData(brand, typeid, minP, maxP).ToList(); var totalRow = model.Count(); var mydata = model.Skip((page - 1) * pageSize).Take(pageSize).ToList(); string loaisp; switch (typeid) { case 1: loaisp = "điện thoại"; break; case 2: loaisp = "laptop"; break; default: loaisp = "sản phẩm"; break; } return(Json(new { data = mydata, status = true, total = totalRow, soluong = totalRow - page * pageSize, loai = loaisp }, JsonRequestBehavior.AllowGet)); }
public ActionResult Detail(int id) { var dao = new CatalogUserDao(); var catalog = dao.GetCatalogById(id); ViewBag.typeid = catalog.catalogtypeid; return(PartialView(catalog)); }
public ActionResult Specifications(int id, int typeid) { var model = new CatalogUserDao().GetCatalogById(id); if (typeid == 1) { return(PartialView("mobiles", model)); } return(PartialView("laptops", model)); }
public ActionResult RelatedProduct(int id) { var dao = new CatalogUserDao(); var catalog = dao.getCatalog(id); var typeId = catalog.catalogtypeid; var brandId = catalog.catalogbrandid; var model = dao.GetAllProductByType(typeId, brandId, id).Take(6); ViewBag.typeName = typeId == 1 ? "điện thoại" : "laptop"; ViewBag.catalogName = catalog.name; return(PartialView(model)); }
public JsonResult Search(string keyword) { var list = new CatalogUserDao().searchFor(keyword); if (list.Count() > 0) { return(Json(new { status = true, data = list }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { status = false, data = list }, JsonRequestBehavior.AllowGet)); } }
public ActionResult FilterBrand(string typeName) { int typeId; switch (typeName) { case "Điện thoại": typeId = 1; break; case "Laptop": typeId = 2; break; default: typeId = 0; break; } ; var dao = new CatalogUserDao(); var brand = dao.getAllCatalogBrand(typeId); return(PartialView(brand)); }
public ActionResult InterestedProduct() { var interested = new CatalogUserDao().GetCatalogs(1, 3, null); return(PartialView(interested)); }
public ActionResult SlideBrand() { var brand = new CatalogUserDao().getAllCatalogBrand(); return(PartialView(brand)); }
public ActionResult CatalogNewest() { List <Catalog> model = new CatalogUserDao().GetCatalogs(1, 9, null); return(PartialView(model)); }
public ActionResult SlideHeader() { List <Catalog> model = new CatalogUserDao().GetCatalogs(1, 4, null); return(PartialView(model)); }