/// <summary> /// The AllNews /// </summary> /// <returns>The <see cref="ActionResult"/></returns> public ActionResult AllNews(string sortOrder, string currentFilter, string searchString, int?page) { if (searchString != null) { page = 1; } else { searchString = currentFilter; } ViewBag.NavTag = "News"; string search = Request.QueryString["search"]; if (search == null) { search = ""; } int pageSize = 9; int pageNumber = (page ?? 1); var news = SQLUtilities.GetAllNews(search); //look below @AsianCarp let me know if this may help ?? not sure how you plan but yeah //FindArticleLogo(news); ViewBag.SearchTerm = search; return(View(news.ToPagedList(pageNumber, pageSize))); }
/// <summary> /// The CreateHomePage /// </summary> /// <returns>The <see cref="HomePageViewModel"/></returns> public static HomePageViewModel CreateHomePage() { HomePageViewModel HPModel = new HomePageViewModel(); List <Club> clubs = SQLUtilities.GetAllClubs(String.Empty).ToList(); HPModel.Clubs = new ObservableCollection <Club>(clubs.Take(4)); List <News> news = SQLUtilities.GetAllNews(String.Empty).ToList(); HPModel.News = new ObservableCollection <News>(news.Take(5)); List <Event> events = SQLUtilities.GetAllEvents(String.Empty).ToList(); HPModel.UpcomingEvents = new ObservableCollection <Event>(events.Take(4)); return(HPModel); }