public JsonResult DeleteBrand(int brandid, int cateid) { ProductDao pd = new ProductDao(); ProductCategorySmallDao psd = new ProductCategorySmallDao(); pd.delBrand(brandid, cateid); psd.DelBrand(brandid); return(Json(new { status = true }, JsonRequestBehavior.AllowGet)); }
public ActionResult LeftMenu() { var dao = new ProductCategoryDao(); var dao1 = new ProductCategorySmallDao(); var model = dao.ListAll(); ViewBag.LiSmall = dao1.ListAll(); return(View(model)); }
// Thay đổi status public JsonResult BrandStatus(int id) { ProductCategorySmallDao psd = new ProductCategorySmallDao(); psd.ChangeStatus(id); ProductDao pd = new ProductDao(); var product = pd.GetProductByBrand(id); foreach (var item in product) { pd.ChangeStatus(item.ID); } return(Json(new { status = true })); }
// Thay đổi cate status public JsonResult CateStatus(int id) { ProductCategoryDao pcd = new ProductCategoryDao(); ProductCategorySmallDao pcsd = new ProductCategorySmallDao(); ProductDao pd = new ProductDao(); var brand = pcsd.ListByCategoryAdmin(id); foreach (var item in brand) { pcsd.ChangeStatus(item.ID); var product = pd.GetProductByBrand(item.ID).ToList(); foreach (var item2 in product) { pd.ChangeStatus(item2.ID); } } pcd.ChangeStatus(id); return(Json(new { status = true })); }
//Thêm Brand public JsonResult AddBrand(string BrandName, int BrandSeq, int CateID) { string data = ""; ProductCategorySmall pcs = new ProductCategorySmall(); ProductCategorySmallDao pcsd = new ProductCategorySmallDao(); try { pcs.Name = BrandName.ToUpper(); pcs.DisplayOrder = BrandSeq; pcs.MetaTitle = ConvertToUnSign(BrandName); pcs.ProductCategoryID = CateID; pcs.Status = false; pcsd.Insert(pcs); data = "Thêm thành công"; } catch { data = "Lỗi"; } return(Json(data, JsonRequestBehavior.AllowGet)); }
public JsonResult GetBrand(int id) { List <ProductCategorySmall> data = new ProductCategorySmallDao().ListByCategoryAdmin(id); return(Json(data, JsonRequestBehavior.AllowGet)); }