public ActionResult EditSection([Bind(Include = "BackgroundColour,ButtonColour,ButtonTextColour,TitleColour,MainTextColour,SectionBackgroundColour,SectionTextColour,SectionTextUnderlineColour")] tbl_UserControl tbl_UserControl, int id) { if (ModelState.IsValid) { List <tbl_UserControl> lstControlsl = db.tbl_UserControl.ToList(); tbl_UserControl userControl = lstControlsl.Single(it => it.Id == id); string typeId = userControl.TypeId; string pageId = userControl.PageId; using (var newContext = new StoreDB()) { var list = newContext.tbl_UserControl; foreach (var el in list.Where(el => (el.TypeId == typeId) && (el.PageId == pageId))) { el.BackgroundColour = tbl_UserControl.BackgroundColour; el.ButtonColour = tbl_UserControl.ButtonColour; el.ButtonTextColour = tbl_UserControl.ButtonTextColour; el.TitleColour = tbl_UserControl.TitleColour; el.MainTextColour = tbl_UserControl.MainTextColour; el.SectionBackgroundColour = tbl_UserControl.SectionBackgroundColour; el.SectionTextColour = tbl_UserControl.SectionTextColour; el.SectionTextUnderlineColour = tbl_UserControl.SectionTextUnderlineColour; } newContext.SaveChanges(); HelperController.RemoveCache(); } return(Redirect("/Admin/GetActionResultForPage/" + Request.QueryString["pageType"])); } return(View(tbl_UserControl)); }
public ActionResult Edit(int?id, [Bind(Include = "Id,Title,Subtitle,MainText,ButtonText,ImageUrl,UrlLink,PageId,TypeId,Active,BackgroundColour,ButtonColour,ButtonTextColour,TitleColour,MainTextColour,SectionBackgroundColour,SectionTextColour,SectionTextUnderlineColour,Priority")] tbl_UserControl tbl_UserControl) { if (ModelState.IsValid) { var list = db.tbl_UserControl.Where(i => i.Id == id); foreach (var el in list) { el.Title = tbl_UserControl.Title; el.MainText = tbl_UserControl.MainText; el.Subtitle = tbl_UserControl.Subtitle; el.ButtonText = tbl_UserControl.ButtonText; el.ImageUrl = tbl_UserControl.ImageUrl; el.UrlLink = tbl_UserControl.UrlLink; el.BackgroundColour = tbl_UserControl.BackgroundColour; el.ButtonColour = tbl_UserControl.ButtonColour; el.ButtonTextColour = tbl_UserControl.ButtonTextColour; el.TitleColour = tbl_UserControl.TitleColour; el.MainTextColour = tbl_UserControl.MainTextColour; el.Active = tbl_UserControl.Active; } db.SaveChanges(); HelperController.RemoveCache(); } return(Redirect("/Admin/GetActionResultForPage/" + Request.QueryString["pageType"])); }
public ActionResult DeleteConfirmed(int id) { tbl_UserControl tbl_UserControl = db.tbl_UserControl.Find(id); db.tbl_UserControl.Remove(tbl_UserControl); db.SaveChanges(); HelperController.RemoveCache(); return(Redirect("/Admin/GetActionResultForPage/" + Request.QueryString["pageType"])); }
public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } tbl_UserControl tblUserControl = db.tbl_UserControl.Find(id); if (tblUserControl == null) { return(HttpNotFound()); } return(View(tblUserControl)); }
public ActionResult Create([Bind(Include = "Id,Title,Subtitle,MainText,ButtonText,ImageUrl,UrlLink,PageId,TypeId,Active,BackgroundColour,ButtonColour,ButtonTextColour,TitleColour,MainTextColour")] tbl_UserControl tbl_UserControl) { if (ModelState.IsValid) { tbl_UserControl.PageId = Request.QueryString["pageType"]; tbl_UserControl.TypeId = Request.QueryString["TypeId"]; db.tbl_UserControl.Add(tbl_UserControl); db.SaveChanges(); HelperController.RemoveCache(); return(Redirect("/Admin/GetActionResultForPage/" + Request.QueryString["pageType"])); } return(View(tbl_UserControl)); }
public ActionResult UpdateTableOrder() { string[] newOrder = Request.Form["item.Priority"].ToString().Split(','); string[] id = Request.Form["item.Id"].ToString().Split(','); string pageId = null; for (int i = 0; i <= newOrder.Length - 1; i++) { tbl_UserControl newTbls = db.tbl_UserControl.Find(Int32.Parse(id[i])); newTbls.Priority = Int32.Parse(newOrder[i]); pageId = newTbls.PageId; db.SaveChanges(); HelperController.RemoveCache(); } return(Redirect("/Admin/GetActionResultForPage/" + pageId)); }
public ActionResult Check(tbl_UserControl tbl_UserControl) { return(Json(new { success = true })); }