public ActionResult Create(Menu menu) { if (ModelState.IsValid) { db.Menu.AddObject(menu); db.SaveChanges(); return RedirectToAction("Logon", "Account"); } ViewBag.Culture = new SelectList(db.Culture, "Id", "Culture1", menu.Culture); ViewBag.Page = new SelectList(db.PageRoute, "Id", "PageAddress", menu.Page); return View(menu); }
public ActionResult Edit(Menu menu) { if (ModelState.IsValid) { db.Menu.Attach(menu); db.ObjectStateManager.ChangeObjectState(menu, EntityState.Modified); db.SaveChanges(); return RedirectToAction("Logon", "Account"); } ViewBag.Culture = new SelectList(db.Culture, "Id", "Culture1", menu.Culture); ViewBag.Page = new SelectList(db.PageRoute, "Id", "PageAddress", menu.Page); return View(menu); }
/// <summary> /// Deprecated Method for adding a new object to the Menu EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToMenu(Menu menu) { base.AddObject("Menu", menu); }
/// <summary> /// Create a new Menu object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="name">Initial value of the Name property.</param> /// <param name="page">Initial value of the Page property.</param> /// <param name="culture">Initial value of the Culture property.</param> public static Menu CreateMenu(global::System.Int32 id, global::System.String name, global::System.Int32 page, global::System.Int32 culture) { Menu menu = new Menu(); menu.Id = id; menu.Name = name; menu.Page = page; menu.Culture = culture; return menu; }