// GET: /MenuItem/Edit/5 public ActionResult Edit(int id = 0, int MenuItem_Id = 0) { List <MenuItem> menuitem = db.MenuItems.ToList(); MenuItem_lang menuitem_lang = db.MenuItem_lang.Find(id); var lang = db.Language.Single(x => x.Default == true); List <MenuItem_lang> parentlist = db.MenuItem_lang.Where(x => x.Lang_ID.Value.Equals(lang.ID)).ToList(); ViewBag.parentlist = new SelectList(parentlist, "Menuitem_ID", "Name", menuitem_lang.Menuitem.Parent_Id); List <PageTemplate> templatelist = db.PageTemp.ToList(); ViewBag.templates = new SelectList(templatelist, "ID", "Name", menuitem_lang.Menuitem.Template.ID); List <Category_lang> categorylist = db.Category_lang.Where(x => x.Lang_ID.Value.Equals(lang.ID)).ToList(); ViewBag.categorylist = new SelectList(categorylist, "category_ID", "Name", menuitem_lang.Menuitem.CatId); ViewBag.lang_Id = lang.ID; ViewBag.menuItem_Id = MenuItem_Id; ViewBag.Id = id; if (menuitem_lang == null) { return(HttpNotFound()); } return(View(menuitem_lang)); }
public ActionResult DeleteConfirmed(int id) { MenuItem_lang menuitem = db.MenuItem_lang.Find(id); MenuItem menuitem_per = db.MenuItems.Find(menuitem.Menuitem_ID); db.MenuItems.Remove(menuitem_per); db.SaveChanges(); return(RedirectToAction("Index")); }
// // GET: /MenuItem_lang/Edit/5 public ActionResult Edit(int id = 0) { MenuItem_lang menuitem_lang = db.MenuItem_lang.Find(id); if (menuitem_lang == null) { return(HttpNotFound()); } return(View(menuitem_lang)); }
public ActionResult DeleteConfirmed(int id) { MenuItem_lang menuitem_lang = db.MenuItem_lang.Find(id); db.MenuItem_lang.Remove(menuitem_lang); db.SaveChanges(); int men_Id = menuitem_lang.Menuitem_ID; return(RedirectToAction("Index", new { id = men_Id })); }
public ActionResult Create(MenuItem_lang menuitem_lang, string hiddenname) { if (ModelState.IsValid) { db.MenuItem_lang.Add(menuitem_lang); db.SaveChanges(); int menId = menuitem_lang.Menuitem_ID; return(RedirectToAction("Index", "MenuItem_lang", new { id = menId })); } return(View(menuitem_lang)); }
// // GET: /MenuItem/Details/5 public ActionResult Details(int id = 0) { List <MenuItem> menuitem = db.MenuItems.ToList(); MenuItem_lang menuitem_lang = db.MenuItem_lang.Find(id); if (menuitem == null) { return(HttpNotFound()); } return(View(menuitem_lang)); }
public ActionResult Edit(MenuItem_lang menuitem_lang) { MenuItem_lang mi = db.MenuItem_lang.Find(menuitem_lang.ID); menuitem_lang.Lang_ID = mi.Lang_ID; menuitem_lang.Menuitem_ID = mi.Menuitem_ID; if (ModelState.IsValid) { db.Entry(mi).CurrentValues.SetValues(menuitem_lang); db.SaveChanges(); int men_Id = mi.Menuitem_ID; return(RedirectToAction("Index", "MenuItem_lang", new { id = men_Id })); } return(View(menuitem_lang)); }
// // GET: /MenuItem_lang/Create public ActionResult Create(int id = 0) { ViewBag.menID = id; List <Language> lang = db.Language.Where(x => x.Default == false).ToList(); List <Language> language = new List <Language>(); foreach (Language obj in lang) { MenuItem_lang menuLang = db.MenuItem_lang.Where(x => x.Lang_ID.Value.Equals(obj.ID) && x.Menuitem_ID == id).SingleOrDefault(); if (menuLang == null) { language.Add(obj); } } ViewBag.Lang_ID = new SelectList(language, "ID", "Name"); return(View()); }
// // GET: /MenuItem/Delete/5 public ActionResult Delete(int id = 0) { ViewBag.flag = false; MenuItem_lang mi_lang = db.MenuItem_lang.Find(id); MenuItem menuitem = db.MenuItems.Find(mi_lang.Menuitem_ID); MenuItem menuitem_son = db.MenuItems.SingleOrDefault(x => x.Parent_Id == menuitem.ID); if (menuitem_son != null) { ViewBag.error = "This MenuItem is a Perant to another MenuItem, So You can not delete it"; ViewBag.flag = true; } if (menuitem == null) { return(HttpNotFound()); } return(View(mi_lang)); }
// // POST: /MenuItem/Edit/5 public JsonResult EditPost(MenuItem mi) { bool status = false; MenuItem m = db.MenuItems.Find(mi.ID); if (mi.CatId == 0) { mi.CatId = m.CatId; } if (mi.ItemId == null) { mi.ItemId = m.ItemId; } if (mi.Parent_Id == null) { mi.Parent_Id = m.Parent_Id; } if (mi.Type == 0) { mi.Type = m.Type; } /* if (mi.Visible == false) * { * mi.Visible = m.Visible; * }*/ MenuItem_lang mi_lang = mi.MenuItemLanguageList[0]; db.Entry(mi_lang).State = EntityState.Modified; db.Entry(m).CurrentValues.SetValues(mi); db.SaveChanges(); status = true; return(new JsonResult { Data = new { status = status } }); }