public ActionResult DeleteConfirmed(int id) { PageDesign pagedesign = PageDesignRepository.GetSingle(id); try { PageDesignRepository.Delete(pagedesign); PageDesignRepository.Save(); if (IsSuperAdmin) { return(RedirectToAction("Index", new { storePageDesignId = pagedesign.StorePageDesignId })); } else { return(RedirectToAction("Index")); } } catch (Exception ex) { Logger.Error(ex, "Unable to delete:" + ex.StackTrace, pagedesign); //Log the error (uncomment dex variable name and add a line here to write a log. ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator."); } return(View(pagedesign)); }
public ActionResult SetPageDesignText(int id = 0, String text = "", String name = "", int storePageDesignId = 0) { var item = new PageDesign(); if (id == 0) { if (storePageDesignId != 0 && !String.IsNullOrEmpty(name)) { var isSamePageNameExists = PageDesignRepository.GetPageDesignByStoreId(storePageDesignId, "") .Any(r => r.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase)); if (isSamePageNameExists) { return(Json("Same name exists.", JsonRequestBehavior.AllowGet)); } item.PageTemplate = text; item.CreatedDate = DateTime.Now; item.State = true; item.Name = name; item.Type = name; item.UpdatedDate = DateTime.Now; PageDesignRepository.Add(item); } } else { item = PageDesignRepository.GetSingle(id); item.PageTemplate = text; item.Name = name; item.Type = name; item.UpdatedDate = DateTime.Now; PageDesignRepository.Edit(item); } PageDesignRepository.Save(); return(Json("", JsonRequestBehavior.AllowGet)); }
// // GET: /PageDesigns/Edit/5 public ActionResult SaveOrEdit(int id = 0, int storePageDesignId = 0) { var pagedesign = new PageDesign(); if (id == 0) { pagedesign.CreatedDate = DateTime.Now; pagedesign.State = true; pagedesign.UpdatedDate = DateTime.Now; pagedesign.StorePageDesignId = storePageDesignId; } else { pagedesign = PageDesignRepository.GetSingle(id); pagedesign.State = true; pagedesign.UpdatedDate = DateTime.Now; } var spd = StorePageDesignRepository.GetSingle(pagedesign.StorePageDesignId); ViewBag.StorePageDesignName = spd.Name; return(View(pagedesign)); }
public ActionResult CopyPageDesign(int id) { PageDesign pagedesign = PageDesignRepository.GetSingle(id); try { var guid = Guid.NewGuid().ToString(); var pagedesignCopy = new PageDesign(); pagedesignCopy.PageTemplate = pagedesign.PageTemplate; pagedesignCopy.Name = pagedesign.Name + "_" + guid; pagedesignCopy.Type = pagedesign.Type + "_" + guid; pagedesignCopy.Id = 0; pagedesignCopy.CreatedDate = DateTime.Now; pagedesignCopy.State = true; pagedesignCopy.UpdatedDate = DateTime.Now; pagedesignCopy.StorePageDesignId = pagedesign.StorePageDesignId; PageDesignRepository.Add(pagedesignCopy); PageDesignRepository.Save(); } catch (Exception ex) { Logger.Error(ex, "Unable to save:" + ex.StackTrace, pagedesign); //Log the error (uncomment dex variable name and add a line here to write a log. ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator."); } if (IsSuperAdmin) { return(RedirectToAction("Index", new { storePageDesignId = pagedesign.StorePageDesignId })); } else { return(RedirectToAction("Index")); } }
// // GET: /PageDesigns/Details/5 public ViewResult Details(int id) { PageDesign pagedesign = PageDesignRepository.GetSingle(id); return(View(pagedesign)); }
// // GET: /PageDesigns/Delete/5 public ActionResult Delete(int id) { PageDesign pagedesign = PageDesignRepository.GetSingle(id); return(View(pagedesign)); }
public ActionResult GetPageDesignText(int id) { var item = PageDesignRepository.GetSingle(id); return(Json(item, JsonRequestBehavior.AllowGet)); }