コード例 #1
0
        public ActionResult Page(string PageName)
        {
            var page = new NewsCategory();

            foreach (var item in db.NewsCategory.Where(i => i.GroupID == "page"))
            {
                if (Exts.ToAscii(item.Name) == PageName)
                {
                    page = item;
                }
            }
            return(View(page));
        }
コード例 #2
0
        public ActionResult Detail(string Name)
        {
            var newsItem = new News();

            foreach (var item in db.News)
            {
                if (Exts.ToAscii(item.Name) == Name)
                {
                    newsItem = item;
                    break;
                }
            }
            return(View(newsItem));
        }
コード例 #3
0
        public ActionResult NewsByCategory(string CategoryName)
        {
            var category = new NewsCategory();

            foreach (var item in db.NewsCategory)
            {
                if (Exts.ToAscii(item.Name) == CategoryName)
                {
                    category = item;
                    break;
                }
            }
            ViewBag.categoryName = category.Name;
            return(View(db.News.Where(i => i.CategoryId == category.Id)));
        }