public async Task <BoardDeleteResponse> BoardDelete(BoardDeleteRequest request) { BoardDeleteResponse response; var board = await _boardRepository.GetAsync(request.Id); if (board == null) { response = new BoardDeleteResponse { Id = Guid.Empty }; response.Failed(_errorService.GetError(ErrorType.ItemNotFound)); return(response); } if (board.CreatedById != request.UserId) { response = new BoardDeleteResponse { Id = Guid.Empty }; response.Failed(_errorService.GetError(ErrorType.AccessDenied)); return(response); } await _boardRepository.RemoveAsync(request.Id); response = _boardCreator.CreateBoardDeleteResponse(request.Id); response.Succeeded(); return(response); }
public async Task <IActionResult> BoardDelete(Guid id) { var boardDeleteRequest = new BoardDeleteRequest { Id = id, UserId = this.GetUserId() }; var boardDeletedResult = await _activitiesService.BoardDelete(boardDeleteRequest); return(Ok(boardDeletedResult)); }
public async Task <BoardDeleteResponse> BoardDelete(BoardDeleteRequest request) { return(await _boardDeleteRequest.Request(request)); }