public ActionResult ConfirmEditProfile(int?id, Gameprofile gameprofile) { var SQLModel = new Gameprofile_SQL(); SQLModel.EditProfile(id, gameprofile); return(RedirectToAction("EditProfile", id)); }
public ActionResult DeleteProfile(int?id) { if (id != null) { var SQLModel = new Gameprofile_SQL(); SQLModel.DeleteGameprofile(id); } return(View("Index")); }
public void StartGame(int gid) { _gameId = gid; Task.Run(SubData).Wait(); var gameInfo = new Game_SQL().GetGame(_gameId)[0]; _global["Game_ID"] = gameInfo["Game_ID"]; _global["Round"] = gameInfo["Current_Round"]; _global["Pokertables"] = gameInfo["Pokertables"]; _global["Gameprofile_Profile_ID"] = gameInfo["Gameprofile_Profile_ID"]; int pr = gameInfo["Gameprofile_Profile_ID"]; var gameProfile = new Gameprofile_SQL().GetGameprofile(pr)[0]; _global["Starting_Budget"] = gameProfile["Starting_Budget"]; _global["Profilename"] = gameProfile["Profilename"]; _global["Pause_Time"] = gameProfile["Pause_Time"]; _global["Pause_After"] = gameProfile["Pause_After"]; _chips["Rebuy"] = gameProfile["Rebuy"]; _rules["Rules"] = gameProfile["Rules"]; _chips["Chips"] = gameProfile["Chips"]; _roundNumber = gameInfo["Current_Round"]; _pauseAfter = gameProfile["Pause_After"]; if (_roundNumber <= 0) { _roundNumber = 1; } var sql = new Round_SQL(); _currentRound = sql.GetRound(_roundNumber, _gameId); Console.WriteLine($"id: {_gameId}"); _roundTimer.Interval = _currentRound.Round_Time.TotalMilliseconds; _pauseTime = (TimeSpan)gameProfile["Pause_Time"]; _totalNumberOfRounds = new Round_SQL().GetNumberOfRounds(_gameId); _global["TotalNumberOfRounds"] = _totalNumberOfRounds; _notificationTimer.Start(); _roundTimer.Start(); _gameTimer.Start(); SetGameStatus(GameStatus.Running); }
/// <summary> /// loads edit profile page with the selected profile data /// </summary> /// <param name="id">url id(profile)</param> /// <param name="gameprofile">profile model</param> /// <returns>edit page with the selected profile data</returns> public ActionResult EditProfile(int?id, Gameprofile gameprofile) { if (id != null) { var SQLModel = new Gameprofile_SQL(); SQLModel.FindProfile(id, gameprofile); } else { return(View("Index")); } AllModels allModels = new AllModels(); allModels.Gameprofile = gameprofile; return(View(allModels)); }
/// <summary> /// gets the selected profiles data /// </summary> /// <param name="id">url id(profile)</param> /// <param name="gameprofile">profile model</param> /// <returns>loads the partialview with the selected profile data</returns> public ActionResult GetProfileData(int?id, Gameprofile gameprofile) { if (id != null) { var SQLModel = new Gameprofile_SQL(); SQLModel.FindProfile(id, gameprofile); } else { return(PartialView("PartialProfileData")); } AllModels allModels = new AllModels(); allModels.Gameprofile = gameprofile; return(PartialView("PartialProfileData", allModels)); }
public ActionResult CreateProfile(Gameprofile gameprofile, Round round) { if (ModelState.IsValid) { var Gameprofile_SQLModel = new Gameprofile_SQL(); int AddedProfileID = Gameprofile_SQLModel.CreateProfile(gameprofile); //Leave i = 1 !! needed for creating the correct round numbers for (int i = 1; i <= round.Number_Of_Rounds; i++) { round.Round_NR = i; round.Gameprofile_Profile_ID = AddedProfileID; var Round_SQLModel = new Round_SQL(); Round_SQLModel.CreateRound(round); } return(RedirectToAction($"EditProfile/{AddedProfileID}")); } return(View("Index")); }