Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
 public async Task <TaskGetResponse> TaskGet(TaskGetRequest request)
 {
     return(await _taskGetRequest.Request(request));
 }