public JsonResult GetOngoingGameList() { try { var gameBusiness = new GameBusiness(); var playerId = Convert.ToInt32(Session["AccountId"]); var ongoingGameList = gameBusiness.OngoingGameList(playerId); List <OngoingGameViewModel> OngoingGameVMList = new List <OngoingGameViewModel>(); for (int i = 0; i < ongoingGameList.Count; i++) { OngoingGameViewModel OngoingGameVM = new OngoingGameViewModel(); var game = gameBusiness.GetGameInfo(ongoingGameList[i].GameId); OngoingGameVM.GameName = game.GameName; OngoingGameVM.OngoingGameId = ongoingGameList[i].Id; if (ongoingGameList[i].EncounterType == 1) { OngoingGameVM.EncounterTypeName = "Bilgisayara Karşı"; } else if (ongoingGameList[i].EncounterType == 2) { OngoingGameVM.EncounterTypeName = "Oyuncuya Karşı"; } OngoingGameVMList.Add(OngoingGameVM); } return(Json(OngoingGameVMList, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(ex, "Devam Eden Oyun Listesi Getirilemedi !")); } }