示例#1
0
        public ActionResult Footer()
        {
            CreateRepos();
            try
            {
                PageFooterControl    Model         = new PageFooterControl();
                List <NewsGroupPage> NewsCategorys = new List <NewsGroupPage>();;

                NewsGroups footerCate = NewsRepos.SearchNewsGroup("footer-affiliate");
                if (footerCate != null)
                {
                    List <NewsGroups> categorys = NewsRepos.GetNewsGroup(footerCate.ID, true, 3);
                    if (categorys.Count() > 0)
                    {
                        foreach (NewsGroups cate in categorys)
                        {
                            NewsGroupPage NewsCategory = new NewsGroupPage();
                            NewsCategory.Name     = cate.Name;
                            NewsCategory.NewsList = NewsRepos.LayDanhSachTinMoiNhatTheoGroupId(5, cate.ID);
                            NewsCategorys.Add(NewsCategory);
                        }
                    }
                }
                Model.NewsCategorys = NewsCategorys;

                NewsGroups WhoSale = NewsRepos.LayNhomTinAn(29);
                if (WhoSale.ID > 0)
                {
                    NewsGroupPage WhoSalePage = new NewsGroupPage();
                    WhoSalePage.Name     = WhoSale.Name;
                    WhoSalePage.NewsList = NewsRepos.LayDanhSachTinMoiNhatTheoGroupId(5, WhoSale.ID);

                    Model.CategoryWhoSale = WhoSalePage;
                }

                string view = "~/Views/" + MainController + "/Elements/Footer.cshtml";
                return(View(view, Model));
            }
            catch (Exception ex)
            {
                return(Content(ex.InnerException.ToString()));
            }
            finally
            {
                DisposeRepos();
            }
        }
示例#2
0
        public ActionResult Footer()
        {
            var model         = new PageFooterControl();
            var newsCategorys = new List <NewsGroupPage>();;

            var footerCate = NewsService.SearchNewsGroup("footer");

            if (footerCate.ID > 0)
            {
                var categorys = NewsService.GetNewsGroup(footerCate.ID, true, 3);
                if (categorys.Any())
                {
                    newsCategorys.AddRange(categorys.Select(cate => new NewsGroupPage
                    {
                        Name = cate.Name, NewsList = NewsService.LayDanhSachTinMoiNhatTheoGroupId(5, cate.ID)
                    }));
                }
            }
            model.NewsCategorys = newsCategorys;

            var whoSale = NewsService.LayNhomTinAn(29);

            if (whoSale.ID > 0)
            {
                var whoSalePage = new NewsGroupPage();
                whoSalePage.Name     = whoSale.Name;
                whoSalePage.NewsList = NewsService.LayDanhSachTinMoiNhatTheoGroupId(5, whoSale.ID);

                model.CategoryWhoSale = whoSalePage;
            }

            var menusFooter = NewsService.SearchNewsGroup("MenusFooter");

            if (menusFooter != null && menusFooter.ID > 0)
            {
                model.MenusFooter = NewsService.GetNewsGroup(menusFooter.ID, true, 6);
            }
            return(View("Footer", model));
        }