public async Task <IActionResult> TaskGet(Guid id, Guid boardId) { var request = new TaskGetRequest { Id = id, BoardId = boardId, UserId = this.GetUserId() }; var response = await _activitiesService.TaskGet(request); return(Ok(response)); }
public async Task <TaskGetResponse> TaskGet(TaskGetRequest request) { TaskGetResponse response; var board = await _boardRepository.GetAsync(request.BoardId); if (board == null) { response = new TaskGetResponse { Data = null }; response.Failed(_errorService.GetError(ErrorType.ItemNotFound)); return(response); } if (board.CreatedById != request.UserId) { response = new TaskGetResponse { Data = null }; response.Failed(_errorService.GetError(ErrorType.AccessDenied)); return(response); } var task = board.Tasks.Single(t => t.Id == request.Id); if (task == null) { response = new TaskGetResponse { Data = null }; response.Failed(_errorService.GetError(ErrorType.ItemNotFound)); return(response); } response = _taskCreator.CreateTaskGetResponse(task); response.Succeeded(); return(response); }
public async Task <TaskGetResponse> TaskGet(TaskGetRequest request) { return(await _taskGetRequest.Request(request)); }