public HttpResponseMessage UpdateGameDefinition(UpdateGameDefinitionMessage updateGameDefinitionMessage, int gameDefinitionId, int gamingGroupId) { if (updateGameDefinitionMessage == null) { return Request.CreateErrorResponse(HttpStatusCode.BadRequest, "You must pass at least one valid parameter."); } var gameDefinitionUpdateRequest = new GameDefinitionUpdateRequest { Active = updateGameDefinitionMessage.Active, Name = updateGameDefinitionMessage.GameDefinitionName, BoardGameGeekGameDefinitionId = updateGameDefinitionMessage.BoardGameGeekGameDefinitionId, GameDefinitionId = gameDefinitionId }; _gameDefinitionSaver.UpdateGameDefinition(gameDefinitionUpdateRequest, CurrentUser); return Request.CreateResponse(HttpStatusCode.NoContent); }
public void ItUpdatesTheGameDefinition() { const int GAME_DEFINITION_ID = 5; const int GAMING_GROUP_ID = 6; var updateGameDefinitionMessage = new UpdateGameDefinitionMessage { GameDefinitionName = "some game definition name", Active = true, BoardGameGeekGameDefinitionId = 2 }; _autoMocker.ClassUnderTest.UpdateGameDefinition(updateGameDefinitionMessage, GAME_DEFINITION_ID, GAMING_GROUP_ID); _autoMocker.Get <IGameDefinitionSaver>().AssertWasCalled(mock => mock.UpdateGameDefinition(Arg <GameDefinitionUpdateRequest> .Matches( updateRequest => updateRequest.GameDefinitionId == GAME_DEFINITION_ID && updateRequest.Active == updateGameDefinitionMessage.Active && updateRequest.Name == updateGameDefinitionMessage.GameDefinitionName && updateRequest.BoardGameGeekGameDefinitionId == updateGameDefinitionMessage.BoardGameGeekGameDefinitionId), Arg <ApplicationUser> .Is.Same(_applicationUser))); }
public HttpResponseMessage UpdateGameDefinition(UpdateGameDefinitionMessage updateGameDefinitionMessage, int gameDefinitionId) { return UpdateGameDefinition(updateGameDefinitionMessage, gameDefinitionId, CurrentUser.CurrentGamingGroupId); }
public HttpResponseMessage UpdateGameDefinition(UpdateGameDefinitionMessage updateGameDefinitionMessage, int gameDefinitionId) { //--gamingGroupId is obsolete here and will be on the request or else used from the current user context -- so just pass "0" return(UpdateGameDefinition(updateGameDefinitionMessage, gameDefinitionId, 0)); }