public ActionResult openMatchView() { if (Session["id"] == null || Session["role"].ToString() != "user") { return(RedirectToRoute("login")); } int playerid = Int32.Parse(Session["id"].ToString()); player = new Player(); csgomatch = new CSGOMatch(); bool isSearching = player.checkIsSearching(playerid); if (isSearching) { return(View("~/Views/Game/MatchQueueView.cshtml")); } else { csgomatch.getOngoingMatches(playerid); ViewBag.x = csgomatch.id; bool playerIsPlayingNow = playerIsPlaying(); if (playerIsPlayingNow) { csgomatch.getMatchInfo(); ViewBag.MatchInfo = csgomatch.id.ToString(); string[] playerInfo1 = new string[5]; string[] playerInfo2 = new string[5]; int index1 = 0; int index2 = 0; for (int i = 0; i < 10; i++) { if (csgomatch.player[i].teamNo == 0) { playerInfo1[index1++] = csgomatch.player[i].player.id.ToString(); } else { playerInfo2[index2++] = csgomatch.player[i].player.id.ToString(); } } ViewBag.PlayerInfo1 = playerInfo1; ViewBag.PlayerInfo2 = playerInfo2; return(View("~/Views/Game/MatchInfoView.cshtml")); } else { player.addToQueue(playerid); return(View("~/Views/Game/MatchQueueView.cshtml")); } } }
public ActionResult getPlayersOngoingMatch(int id) { if (Session["id"] == null || Session["role"].ToString() != "user") { return(RedirectToRoute("login")); } csgomatch = new CSGOMatch(); csgomatch.getOngoingMatches(id); csgomatch.getMatchInfo(); if (csgomatch.id != 0) { return(Json("1")); } else { return(Json("0")); } }