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)); }
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)); }
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))); }