예제 #1
0
        public async Task <ActionResult> ReturnToMainView(int SiteId)
        {
            ModelState.Clear();
            ViewBag.CurrSiteID = SiteId;
            List <SiteMiscModel> SiteMISC = new List <SiteMiscModel>();
            await Task.Run(() =>
            {
                SiteMISC.AddRange(BORepository.GetAllSiteMISC(proxy, SiteId).Result);
            });

            SiteMiscModelLD com = new SiteMiscModelLD();

            com.DetailView = new SiteMiscModel();
            com.ListView   = SiteMISC;
            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(View("GetAllSiteMisc", com));
        }
예제 #2
0
        public async Task <ActionResult> EditSiteMisc(int SiteMISCID = 0, int SiteID = 0)
        {
            if (SiteMISCID != 0)
            {
                List <SiteMiscModel> SiteMICs = new List <SiteMiscModel>();
                await Task.Run(() =>
                {
                    SiteMICs.AddRange(BORepository.GetAllSiteMISC(proxy, SiteID).Result);
                });

                SiteMiscModelLD com = new SiteMiscModelLD();
                com.DetailView = SiteMICs.FirstOrDefault(view => view.Id == SiteMISCID);
                com.ListView   = SiteMICs;
                if (SiteMICs.Count > 0)
                {
                    com.SiteName = SiteMICs[0].SiteName;
                    com.SiteID   = SiteID;
                }
                ViewBag.CurrSiteID = SiteID;
                return(View("GetAllSiteMisc", com));
            }
            else
            {
                return(RedirectToAction("GetAllSiteMisc", new { SiteId = SiteID }));
            }
        }