public async Task <ResultResponse> UpdateAsync(int id, TicTacToeCreationViewModel ticTacToeCreationViewModel) { var ticTacToe = _mapper.Map <TicTacToe>(ticTacToeCreationViewModel); var squares = _mapper.Map <IEnumerable <TicTacToeSquare> >(ticTacToeCreationViewModel.Squares); var businessResult = await _ticTacToeService.UpdateAsync(id, ticTacToe, squares); return(new ResultResponse(businessResult, Operation.UPDATE)); }
public async Task <IActionResult> CreateAsync([FromBody] TicTacToeCreationViewModel ticTacToeViewModel) { var resultTicTacToeCreated = await _ticTacToeAppService.CreateAsync(ticTacToeViewModel); if (resultTicTacToeCreated.StatusCode == Application.Core.StatusCode.BAD_REQUEST) { return(BadRequest(resultTicTacToeCreated.Errors)); } return(CreatedAtRoute("", ticTacToeViewModel)); }
public async Task <IActionResult> UpdateAsync(int ticTacToeId, [FromBody] TicTacToeCreationViewModel ticTacToeViewModel) { var resultTicTacToeUpdated = await _ticTacToeAppService.UpdateAsync(ticTacToeId, ticTacToeViewModel); if (resultTicTacToeUpdated.StatusCode == Application.Core.StatusCode.BAD_REQUEST) { return(BadRequest(resultTicTacToeUpdated.Errors)); } if (resultTicTacToeUpdated.StatusCode == Application.Core.StatusCode.NOT_FOUND) { return(NotFound(resultTicTacToeUpdated.Errors)); } return(Ok()); }