Esempio n. 1
0
 partial void DeleteMenu(Menu instance);
Esempio n. 2
0
 partial void InsertMenu(Menu instance);
Esempio n. 3
0
 partial void UpdateMenu(Menu instance);
Esempio n. 4
0
		private void detach_Menus(Menu entity)
		{
			this.SendPropertyChanging();
			entity.MenuType = null;
		}
Esempio n. 5
0
		private void attach_Menus(Menu entity)
		{
			this.SendPropertyChanging();
			entity.MenuType = this;
		}
Esempio n. 6
0
 public void Insert( Menu menu )
 {
     _db.Menus.InsertOnSubmit( menu );
     Save();
 }
Esempio n. 7
0
 public void Delete( Menu menu )
 {
     _db.Menus.DeleteOnSubmit( menu );
     Save();
 }
Esempio n. 8
0
        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();
            }
        }