// GET: Movies public ActionResult Index() { GameModel gameModel = new GameModel(); gameModel.SearchDB = getNew(); return View(gameModel); }
public ActionResult Search(string query) { ViewBag.Query = query; string url = string.Format("http://www.giantbomb.com/api/search?api_key={0}&format=json&query={1}&resources=game", apikey, query); GameModel searchList = new GameModel(); searchList.SearchDB = JsonConvert.DeserializeObject<SearchGameDB>(ApiCall.ApiGET(url)); return View(searchList); }
public ActionResult Title() { try { string gameID = Url.RequestContext.RouteData.Values["id"].ToString(); GameModel gameModel = new GameModel(); gameModel.gd = getDetail(gameID); // Getting Video Links if(gameModel.gd.results.videos != null) { gameModel.Videos = new List<Video>(); foreach(GameDetail.Video video in gameModel.gd.results.videos) { try { string url = string.Format("http://www.giantbomb.com/api/video/2300-{0}/?api_key={1}&format=json", video.id, apikey); Video temp = JsonConvert.DeserializeObject<Video>(ApiCall.ApiGET(url)); gameModel.Videos.Add(temp); } catch(Exception ex) { } } } if (gameModel.gd.results.similar_games != null) { gameModel.sg = new List<SimilarGame>(); foreach (GameDetail.Similar_Games sg in gameModel.gd.results.similar_games) { try { string url = string.Format("http://www.giantbomb.com/api/game/3030-{0}/?api_key={1}&format=json&field_list=image,id", sg.id, apikey); SimilarGame temp = JsonConvert.DeserializeObject<SimilarGame>(ApiCall.ApiGET(url)); gameModel.sg.Add(temp); } catch (Exception ex) { } } } return View(gameModel); } catch (Exception ex) { GameModel gameModel = new GameModel(); gameModel.gd = new GameDetail(); return View(gameModel); } }