public ActionResult DeletePlayer(int id) { bool deletedSelf = _game.GameDeletePlayer(id); ////check that the player being deleted is the player logged in. ////log him out and redirect to login page. with a message Player lgp = (Player)_cache.Get("loggedInPlayer"); if (!deletedSelf) { //TempData["deletedMyself"] = "Looks like you deleted ourself. Please user a unique name to log in and create your account again."; return(RedirectToAction("Logout", id)); } return(RedirectToAction("PlayerList")); }
public ActionResult DeletePlayer(int id) { bool deletedSelf = _game.GameDeletePlayer(id); ////check that the player being deleted is the player logged in. ////log him out and redirect to login page. with a message if (!deletedSelf) { //TempData["deletedMyself"] = "Looks like you deleted ourself or this player cannot be deleted because he has played a game. \nPlease user a unique name to log in and create your account again."; //players.Remove(players.Where(x => x.PlayerId == id).FirstOrDefault()); return(RedirectToAction("Logout", id)); } return(RedirectToAction("PlayerList")); }
public IActionResult DeletePlayer(int id) { bool deletedSelf = _game.GameDeletePlayer(id); ////check that the player being deleted is the player logged in. ////log him out and redirect to login page. with a message //Player lgp = (Player)_cache.Get("loggedInPlayer"); if (!deletedSelf) { TempData["deletedMyself"] = "Looks like you deleted ourself. Please user a unique name to log in and create your account again."; //players.Remove(players.Where(x => x.PlayerId == id).FirstOrDefault()); return(RedirectToAction("Logout", id)); } //players.Remove(players.Where(x => x.PlayerId == id).FirstOrDefault()); //SaveChanges(); return(RedirectToAction("PlayerList")); }