public ActionResult Game(GameDTO viewModel) { try { var message = String.Empty; if (viewModel.Id != null) { _gameManagement.UpdateGame(viewModel); message = "app:gameIntegration.games.updated"; } else { _gameManagement.CreateGame(viewModel); message = "app:gameIntegration.games.created"; } return(this.Success(message)); } catch (ValidationError e) { return(ValidationErrorResponseActionResult(e)); } catch (Exception e) { return(this.Failed(e)); } }
public void Can_Edit_Game() { Assert.AreEqual(0, _queries.GetGameDtos().Count()); var gameDto = new GameDTO { Name = "Game", Code = "Code", Type = "Casino", Status = "Active", Url = "http://localhost/", ProductId = _repository.GameProviders.First().Id }; _gameManagement.CreateGame(gameDto); Assert.AreEqual(1, _queries.GetGameDtos().Count()); var game = _queries.GetGameDtos().First(); game.Name = "Game updated"; game.Code = "Code updated"; _gameManagement.UpdateGame(game); game = _queries.GetGameDtos().First(); Assert.AreEqual("Game updated", game.Name); Assert.AreEqual("Code updated", game.Code); Assert.NotNull(game.UpdatedBy); Assert.NotNull(game.UpdatedDate); }