public void DeletePlayerTest() { var manager = new PlayerManager(); var _players = manager.GetAllPlayers(); int count = _players.Count(); var player2 = _players.FirstOrDefault(p => p.Id == 2); var player3 = _players.FirstOrDefault(p => p.Id == 3); manager.RemovePlayerById(player2.Id); manager.RemovePlayerById(player3.Id); bool result = (_players.Count == count - 2); Assert.IsTrue(result); foreach (var p in _players) { Console.WriteLine($"{p.Id}, {p.FirstName}, {p.LastName}, {p.Position}"); } }
public ActionResult DeletePlayer(Player player) { var manager = new PlayerManager(); manager.RemovePlayerById(player.Id); return RedirectToAction("Players"); }