public PartialViewResult HotProducts(int id, string title) { try { SupplierModel _SUPPLIER = new SupplierModel(); Session["SUPPLIER"] = _SUPPLIER.GetSupplierName(id); Session["SUPPLIER_MODEL"] = db.SUPPLIERS.Find(id); ViewBag.Supplier = db.SUPPLIERS.Find(id); ViewBag.Header = title; List <PRODUCT> _lstPRODUCT = db.PRODUCTS.Where(n => n.SUPPLIER_ID == id && n.IS_ACTIVE && n.IS_NEW).OrderByDescending(n => n.IDX).Take(8).ToList(); if (_lstPRODUCT.Count > 7) { return(PartialView(_lstPRODUCT)); } else { return(PartialView()); } } catch (Exception ex) { throw ex; // 404 } }
public ActionResult AddCategory(int id_sup, int id_cate) { try { CATEGORIES_BY_SUPPLIER _CATEGORIER_BY_SUPPLIER = new CATEGORIES_BY_SUPPLIER(); _CATEGORIER_BY_SUPPLIER.SUPPLIER_ID = id_sup; _CATEGORIER_BY_SUPPLIER.SUPPLIER_NAME = m_SUPPLIER_MODEL.GetSupplierName(id_sup); _CATEGORIER_BY_SUPPLIER.CATEGORY_ID = id_cate; _CATEGORIER_BY_SUPPLIER.CATEGORY_NAME = m_CATEGORY_MODEL.GetCategoryName(id_cate); db.CATEGORIES_BY_SUPPLIER.Add(_CATEGORIER_BY_SUPPLIER); db.SaveChanges(); return(RedirectToAction("ManagingCategoriesBySupplier", "Admin")); } catch (Exception ex) { throw ex; } }
public PartialViewResult CategoryMenu(int id) { try { SupplierModel _SUPPLIER = new SupplierModel(); Session["SUPPLIER"] = _SUPPLIER.GetSupplierName(id); Session["SUPPLIER_MODEL"] = db.SUPPLIERS.Find(id); ViewBag.SUPPLIER_ID = id; List <CATEGORIES_BY_SUPPLIER> _lstCATEGORY = db.CATEGORIES_BY_SUPPLIER.Where(n => n.SUPPLIER_ID == id).ToList(); return(PartialView(_lstCATEGORY)); } catch (Exception ex) { throw ex; // 404 } }
public ViewResult Accessory_Bosch(int cate_id) // BOSCH 23 { try { SupplierModel _SUPPLIER = new SupplierModel(); Session["SUPPLIER"] = _SUPPLIER.GetSupplierName(23); Session["SUPPLIER_MODEL"] = db.SUPPLIERS.Find(23); List <PRODUCT> _lstPRODUCT = db.PRODUCTS.Where(n => n.SUPPLIER_ID == 23 && n.CATEGORY_ID == cate_id).ToList(); ViewBag.CategoryName = db.CATEGORIES.Single(n => n.CATEGORY_ID == cate_id).CATEGORY_NAME; return(View(_lstPRODUCT)); } catch (Exception ex) { Response.StatusCode = 404; return(null); } }
public ViewResult Category(int supplier_id, string supplier_code, int cate_id) { try { SupplierModel _SUPPLIER = new SupplierModel(); Session["SUPPLIER"] = _SUPPLIER.GetSupplierName(supplier_id); Session["SUPPLIER_MODEL"] = db.SUPPLIERS.Find(supplier_id); List <PRODUCT> _lstPRODUCT = db.PRODUCTS.Where(n => n.SUPPLIER_ID == supplier_id && n.CATEGORY_ID == cate_id).ToList(); ViewBag.CategoryName = db.CATEGORIES.Single(n => n.CATEGORY_ID == cate_id).CATEGORY_NAME; return(View(_lstPRODUCT)); } catch (Exception ex) { Response.StatusCode = 404; return(null); } }
public ActionResult Detail_Bosch(int id) { try { SupplierModel _SUPPLIER = new SupplierModel(); Session["SUPPLIER"] = _SUPPLIER.GetSupplierName(db.PRODUCTS.Find(id).SUPPLIER_ID); Session["SUPPLIER_MODEL"] = db.SUPPLIERS.Find(db.PRODUCTS.Find(id).SUPPLIER_ID); PRODUCT _PRODUCT = db.PRODUCTS.Find(id); ViewBag.CategoryID = _PRODUCT.CATEGORY_ID; ViewBag.CategoryNAME = db.CATEGORIES.Single(n => n.CATEGORY_ID == _PRODUCT.CATEGORY_ID).CATEGORY_NAME; return(View(_PRODUCT)); } catch (Exception ex) { return(RedirectToAction("Http404", "Error")); // 404 } }
public ActionResult Detail(int id) { try { SupplierModel _SUPPLIER = new SupplierModel(); PRODUCT _PRODUCT = new PRODUCT(); if (db.PRODUCTS.Find(id) != null) { Session["SUPPLIER"] = _SUPPLIER.GetSupplierName(db.PRODUCTS.Find(id).SUPPLIER_ID); Session["SUPPLIER_MODEL"] = db.SUPPLIERS.Find(db.PRODUCTS.Find(id).SUPPLIER_ID); _PRODUCT = db.PRODUCTS.Find(id); } return(View(_PRODUCT)); } catch (Exception ex) { return(RedirectToAction("Http404", "Error")); // 404 } }