コード例 #1
0
        public ActionResult SearchGamesMain(string Id, string state)
        {
            string search = Request.Form["search"];

            if (state != "Global" && state != null)
            {
                DataRepository helper = new DataRepository();

                IList<Item> games = helper.getSpecificItemsInNetworkSearch(Id, 4, search, 100);
                if (games.Count() < 1)
                {
                    ViewData["NoResults"] = "Sorry, there are no results for '" + search + "'";
                }
                string yob = helper.getYOB(Id);
                string stereotype = helper.getStereotype(Id);
                bool male = helper.isMale(Id);
                string recentItem = helper.getMostRecentItem(Id);
                string recentItemId = helper.getMostRecentItemId(Id);
                string location = helper.getLocation(Id);

                ViewData["gamesTopLinks"] = helper.getItemTopLinks(games);
                ViewData["gamesYouTubes"] = helper.getItemYouTubes(games);

                return PartialView(new ItemViewModel(null, null, null, games, null, null, Id, "User", yob, stereotype, male, recentItem, "", recentItemId,location));
            }
            else//Global State
            {
                DataRepository helper = new DataRepository();
                IList<Item> games = helper.getSpecificItemsSearch(4, search, 100);
                if (games.Count() < 1)
                {
                    ViewData["NoResults"] = "Sorry, there are no results for '" + search + "'";
                }
                ViewData["gamesTopLinks"] = helper.getItemTopLinks(games);
                ViewData["gamesYouTubes"] = helper.getItemYouTubes(games);

                return PartialView(new ItemViewModel(null, null, null, games, null, null, null, "Global", "", "", false, "", "", "",""));
            }
        }