public static bool DeleteGame(int gameId) { bool result = false; try { var game = GameAccessor.RetrieveGame(gameId); GameAccessor.DeleteGame(gameId); ConsoleManager.VerifyConsole(game.Console); DeveloperManager.VerifyDeveloper(game.Developer); PublisherManager.VerifyPublisher(game.Publisher); } catch { throw; } return(result); }
public static bool UpdateGame(Game oldGame, Game newGame) { bool result = false; try { if (GameAccessor.RetrieveGame(oldGame.Id) != oldGame) { throw new ApplicationException("Game has been updated since last retrieval!"); } else { if (!DeveloperManager.UpdateDeveloper(newGame.Developer)) { throw new ApplicationException("Developer failed to update!"); } if (!ConsoleManager.UpdateConsole(newGame.Console)) { throw new ApplicationException("Console failed to update!"); } if (!PublisherManager.UpdatePublisher(newGame.Publisher)) { throw new ApplicationException("Publisher failed to update!"); } result = 1 == GameAccessor.UpdateGame(oldGame, newGame); ConsoleManager.VerifyConsole(oldGame.Console); DeveloperManager.VerifyDeveloper(oldGame.Developer); PublisherManager.VerifyPublisher(oldGame.Publisher); } } catch { throw; } return(result); }