public JsonResult DeleteCollection(int id) { UserLogin user = (UserLogin)Session[CommonConstants.USER_SESSION]; //check for prouduct exits on brand string messageDelete = ""; bool resultDelete = false; var lstProduct = ProductDAO.GetListProductByCollectionID(id, 1); if (lstProduct.Count > 0) { resultDelete = false; messageDelete = "Hiện đang có " + lstProduct.Count + " sản phẩm thuộc bộ sưu tập này. Không thể xóa!"; } else { resultDelete = CollectionDAO.DeleteCollection(id, user.UserID.ToString()); messageDelete = "Xóa thành công"; SetAlert($"Xóa Collection {id} thành công", "success"); } return(Json( new { status = resultDelete, message = messageDelete })); }
public ActionResult ListRealCaseByBrandID(int id, string name) { List <RealCaseBO> lstRealCase = CollectionDAO.GetListRealCaseByBrandID(id, 8); ViewBag.CollectionID = id; ViewBag.CollectionName = name; return(PartialView("ListRealCaseByCollectionID")); }
public ActionResult RealProductAtWaduCase(ProductBO objProduct) { int id = 3; List <RealCaseBO> lstRealCase = CollectionDAO.GetListRealCaseByCollectionID(id, 8); return(PartialView(lstRealCase)); }
public ActionResult UpdateCollection(int id = 0) { CollectionBO model = new CollectionBO(); if (id > 0) { model = CollectionDAO.GetCollectionByID(id); } return(View(model)); }
public ActionResult Collection(int page = 1, int pageSize = 100) { var lstCollection = CollectionDAO.GetAllCollection(); if (lstCollection == null) { lstCollection = new List <CollectionBO>(); } return(View(lstCollection.OrderBy(x => x.displayorder).ToList())); }
public ActionResult UpdateCollection(CollectionBO collectionModel) { if (ModelState.IsValid) { UserLogin user = (UserLogin)Session[CommonConstants.USER_SESSION]; string errorMessage = ""; bool result = false; collectionModel.isdeleted = 0; if (collectionModel.id > 0) { //get updatemodel CollectionBO newUpdateBO = new CollectionBO(); newUpdateBO = CollectionDAO.GetCollectionByID(collectionModel.id); if (newUpdateBO == null) { ModelState.AddModelError("", "Collection không tồn tại"); return(View(collectionModel)); } newUpdateBO.updateduser = user.UserID.ToString(); newUpdateBO.updateddate = DateTime.Now; newUpdateBO.description = collectionModel.description; newUpdateBO.keyword = collectionModel.keyword; newUpdateBO.logo = collectionModel.logo; newUpdateBO.metadescription = collectionModel.metadescription; newUpdateBO.metakeyword = collectionModel.metakeyword; newUpdateBO.name = collectionModel.name; newUpdateBO.seoname = collectionModel.seoname; newUpdateBO.displayorder = collectionModel.displayorder; result = CollectionDAO.UpdateCollection(newUpdateBO, ref errorMessage); SetAlert($"Cập nhật Collection {collectionModel.id}-{collectionModel.name} thành công", "success"); } else { collectionModel.createduser = user.UserID.ToString(); collectionModel.createddate = DateTime.Now; result = CollectionDAO.InsertCollection(collectionModel, ref errorMessage); SetAlert($"Thêm Collection {collectionModel.name} thành công", "success"); } if (result) { return(RedirectToAction("Collection", "Category")); } else { ModelState.AddModelError("", "Có lỗi xảy ra. Thêm thất bại: " + errorMessage); } } return(View(collectionModel)); }
public ActionResult SideBar(int currentID, bool isCollectionLoad) { var lstCollection = CollectionDAO.GetAllCollection(); var lstBrand = BrandModel.GetAllBrand(); if (lstCollection.Count == 0 && lstBrand.Count() == 0) { return(RedirectToAction("NotFound", "Error")); } ViewBag.ListCollection = lstCollection; ViewBag.ListBrand = lstBrand; ViewBag.CurrentID = currentID; ViewBag.IsCollectionLoad = isCollectionLoad; return(PartialView()); }
public ActionResult Collection(string metatitle, int id, string orderby = "") { if (metatitle.Length <= 0 && metatitle.Split('-').Count() < 2) { return(RedirectToAction("NotFound", "Error")); } var collectionInfo = CollectionDAO.GetCollectionByID(id); if (collectionInfo == null) { return(RedirectToAction("NotFound", "Error")); } var commonInfo = LocationDAO.GetCommonInfoByID("commoninfo"); ViewBag.OrderBy = orderby; ViewBag.CommonInfo = commonInfo; return(View(collectionInfo)); }
public ActionResult MenuBar(bool isMobile) { List <CollectionBO> lstCollection = CollectionDAO.GetAllCollection(); if (isMobile) { return(PartialView("MenuBarMobile", lstCollection)); } //gio-hang List <CartSession> lstCartItem = new List <CartSession>(); lstCartItem = Session["fancycart"] as List <CartSession>; if (lstCartItem == null) { lstCartItem = new List <CartSession>(); } ViewBag.ListCartItem = lstCartItem; return(PartialView("MenuBar", lstCollection)); }
public ActionResult GetAllCollection() { List <CollectionBO> lstCollection = CollectionDAO.GetAllCollection(); return(PartialView(lstCollection)); }
public ActionResult GetFeatureCollection() { List <CollectionBO> lstCollection = CollectionDAO.GetFeatureCollection(2); return(PartialView("FeatureCollection", lstCollection)); }
public void InitSelectListCollection(long?selectedID = null) { ViewBag.CollectionID = new SelectList(CollectionDAO.GetAllCollection(), "id", "name", selectedID); }