public bool EditGame(Game oldGame, Game newGame) { try { return(GameAccessor.UpdateGame(oldGame, newGame) == 1); } catch (Exception) { return(false); } }
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); }