partial void DeleteMenu(Menu instance);
partial void InsertMenu(Menu instance);
partial void UpdateMenu(Menu instance);
private void detach_Menus(Menu entity) { this.SendPropertyChanging(); entity.MenuType = null; }
private void attach_Menus(Menu entity) { this.SendPropertyChanging(); entity.MenuType = this; }
public void Insert( Menu menu ) { _db.Menus.InsertOnSubmit( menu ); Save(); }
public void Delete( Menu menu ) { _db.Menus.DeleteOnSubmit( menu ); Save(); }
public ActionResult Edit( String[] menuNames, String[] menuUrls ) { try { // TODO: Add update logic here var type = Int32.Parse( Request.Form["type"] ); var menus = menuRepository.GetMenus( type ); foreach (var menu in menus) menuRepository.Delete( menu ); var orderN = 1; for (var i = 0; i < menuNames.Count(); i++) { if (String.IsNullOrEmpty( menuNames[i] ) || String.IsNullOrEmpty( menuUrls[i] )) continue; var menu = new Menu {order_n = orderN, name = menuNames[i], url = menuUrls[i], type_id = type}; menuRepository.Insert( menu ); orderN++; } return RedirectToAction( "Index" ); } catch { return View(); } }