示例#1
0
        /// <summary>
        /// The AllClubs
        /// </summary>
        /// <param name="sortOrder">The sortOrder<see cref="string"/></param>
        /// <param name="currentFilter">The currentFilter<see cref="string"/></param>
        /// <param name="searchString">The searchString<see cref="string"/></param>
        /// <param name="page">The page<see cref="int?"/></param>
        /// <returns>The <see cref="ActionResult"/></returns>
        public ActionResult AllClubs(string sortOrder, string currentFilter, string searchString, int?page)
        {
            if (searchString != null)
            {
                page = 1;
            }
            else
            {
                searchString = currentFilter;
            }

            //Sets the title
            ViewBag.NavTag = "Clubs";

            // Required for stored proc, default is blank
            string search = Request.QueryString["search"];

            if (search == null)
            {
                search = "";
            }

            int pageSize   = 6;
            int pageNumber = (page ?? 1);

            var clubs = SQLUtilities.GetAllClubs(search);

            ViewBag.SearchTerm = search;

            return(View(clubs.ToPagedList(pageNumber, pageSize)));
        }
示例#2
0
        /// <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);
        }