public ActionResult Recently(string Id, string state) { if (state != "Global") { DataRepository helper = new DataRepository(); IList<Item> mostRecentItems = helper.getMostRecentItemsInNetwork(Id,100); 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["recentTopLinks"] = helper.getItemTopLinks(mostRecentItems); ViewData["recentYouTubes"] = helper.getItemYouTubes(mostRecentItems); ViewData["Following"] = helper.getFollowingCount(Id); ViewData["FollowedBy"] = helper.getFollowedByCount(Id); return View(new ItemViewModel(null, null, null, null, null, mostRecentItems, Id, "Network", yob, stereotype, male, recentItem, "",recentItemId,location)); } else//Global State { DataRepository helper = new DataRepository(); IList<Item> mostRecentItems = helper.getMostRecentItems(100); ViewData["recentTopLinks"] = helper.getItemTopLinks(mostRecentItems); ViewData["recentYouTubes"] = helper.getItemYouTubes(mostRecentItems); return View(new ItemViewModel(null, null, null, null, null, mostRecentItems, null, "Global", "", "", false, "", "","","")); } }
public ActionResult Index(string Id, string state) { int ten = 10; if (state != "Global" && state != null) { DataRepository helper = new DataRepository(); IList<Item> songs = helper.getSpecificItemsInNetwork(Id,1,ten); IList<Item> films = helper.getSpecificItemsInNetwork(Id,6,ten); IList<Item> books = helper.getSpecificItemsInNetwork(Id,3,ten); IList<Item> games = helper.getSpecificItemsInNetwork(Id,4,ten); IList<Item> apps = helper.getSpecificItemsInNetwork(Id,5,ten); IList<Item> mostRecentItems = helper.getMostRecentItemsInNetwork(Id,ten); 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["songsTopLinks"] = helper.getItemTopLinks(songs); ViewData["songsYouTubes"] = helper.getItemYouTubes(songs); ViewData["filmsTopLinks"] = helper.getItemTopLinks(films); ViewData["filmsYouTubes"] = helper.getItemYouTubes(films); ViewData["booksTopLinks"] = helper.getItemTopLinks(books); ViewData["booksYouTubes"] = helper.getItemYouTubes(books); ViewData["gamesTopLinks"] = helper.getItemTopLinks(games); ViewData["gamesYouTubes"] = helper.getItemYouTubes(games); ViewData["appsTopLinks"] = helper.getItemTopLinks(apps); ViewData["appsYouTubes"] = helper.getItemYouTubes(apps); ViewData["recentTopLinks"] = helper.getItemTopLinks(mostRecentItems); ViewData["recentYouTubes"] = helper.getItemYouTubes(mostRecentItems); ViewData["Following"] = helper.getFollowingCount(Id); ViewData["FollowedBy"] = helper.getFollowedByCount(Id); return View(new ItemViewModel(songs, films, books, games, apps,mostRecentItems,Id,"User",yob,stereotype,male,recentItem,"",recentItemId,location)); } else//Global State { DataRepository helper = new DataRepository(); IList<Item> songs = helper.getSpecificItems(1,ten); IList<Item> films = helper.getSpecificItems(6, ten); IList<Item> books = helper.getSpecificItems(3, ten); IList<Item> games = helper.getSpecificItems(4, ten); IList<Item> apps = helper.getSpecificItems(5, ten); IList<Item> mostRecentItems = helper.getMostRecentItems(ten); ViewData["songsTopLinks"] = helper.getItemTopLinks(songs); ViewData["songsYouTubes"] = helper.getItemYouTubes(songs); ViewData["filmsTopLinks"] = helper.getItemTopLinks(films); ViewData["filmsYouTubes"] = helper.getItemYouTubes(films); ViewData["booksTopLinks"] = helper.getItemTopLinks(books); ViewData["booksYouTubes"] = helper.getItemYouTubes(books); ViewData["gamesTopLinks"] = helper.getItemTopLinks(games); ViewData["gamesYouTubes"] = helper.getItemYouTubes(games); ViewData["appsTopLinks"] = helper.getItemTopLinks(apps); ViewData["appsYouTubes"] = helper.getItemYouTubes(apps); ViewData["recentTopLinks"] = helper.getItemTopLinks(mostRecentItems); ViewData["recentYouTubes"] = helper.getItemYouTubes(mostRecentItems); return View(new ItemViewModel(songs, films, books, games, apps, mostRecentItems, null, "Global","","",false,"","","","")); } }