async Task <MenuModelLD> GetCommonModel(int SiteId) { ModelState.Clear(); List <MenuModel> Menu = new List <MenuModel>(); await Task.Run(() => { Menu.AddRange(BORepository.GetAllMenu(proxy, SiteId).Result); }); MenuModelLD com = new MenuModelLD(); com.DetailView = new MenuModel(); await Task.Run(() => { com.DetailView.View = BORepository.GetAllViews(proxy, SiteId).Result.ToList(); }); com.ListView = Menu; await Task.Run(() => { List <SiteModel> Sites = BORepository.GetAllSites(proxy, SiteId).Result; if (Sites != null && Sites.Count > 0) { com.SiteName = Sites.First().Title; com.SiteID = Sites.First().Oid; } }); return(com); }
public async Task <ActionResult> EditMenu(int MenuID = 0, int SiteID = 0) { if (MenuID != 0) { List <MenuModel> Menus = new List <MenuModel>(); await Task.Run(() => { Menus.AddRange(BORepository.GetAllMenu(proxy, SiteID).Result); }); MenuModelLD com = new MenuModelLD(); com.DetailView = Menus.FirstOrDefault(menu => menu.Id == MenuID); await Task.Run(() => { com.DetailView.View = BORepository.GetAllViews(proxy, SiteID).Result.ToList(); }); com.ListView = Menus; if (Menus.Count > 0) { com.SiteName = Menus[0].SiteName; com.SiteID = SiteID; } ViewBag.CurrSiteID = SiteID; return(View("GetAllMenu", com)); } else { return(RedirectToAction("GetAllMenu", new { SiteId = SiteID })); } }