public ActionResult DeleteMenuFromParty(int MenuId, int PartyId) { var Facade = new Facade(); var Party = new Party(); Party = Facade.GetPartyGateway().Get(PartyId); foreach (var item in Party.Menus.ToList()) { if(item.Id == MenuId) { Party.Menus.Remove(item); break; } } Facade.GetPartyGateway().Update(Party.Id, Party); return RedirectToAction("EditParty", new { PartyId = PartyId }); }
public ActionResult EditParty(int PartyId) { var Facade = new Facade(); EditPartyModel PartyModel; var Party = new Party(); Party = Facade.GetPartyGateway().Get(PartyId); List<Menu> menuList = new List<Menu>(); menuList = Facade.GetMenuGateway().GetAll().ToList(); foreach (var item in menuList.ToList()) { if (Party.Menus.Contains(item)) { menuList.Remove(item); } } PartyModel = new EditPartyModel { MenuList = menuList, Party = Party }; return View(PartyModel); }
public ActionResult EditParty2(Party Party) { var Facade = new Facade(); var PartyNew = new Party(); PartyNew = Facade.GetPartyGateway().Get(Party.Id); //PartyNew.Menus = Party.Menus; PartyNew.FestNummer = Party.FestNummer; PartyNew.UseDate = Party.UseDate; PartyNew.Description = Party.Description; Facade.GetPartyGateway().Update(PartyNew.Id, PartyNew); return RedirectToAction("EditParty", new { PartyId = Party.Id }); }