Beispiel #1
0
        public async Task <TaskGetListResponse> TaskGetList(TaskGetListRequest request)
        {
            TaskGetListResponse response;

            var board = await _boardRepository.GetAsync(request.BoardId);

            if (board == null)
            {
                response = new TaskGetListResponse {
                    Data = null
                };
                response.Failed(_errorService.GetError(ErrorType.ItemNotFound));

                return(response);
            }

            if (board.CreatedById != request.UserId)
            {
                response = new TaskGetListResponse {
                    Data = null
                };
                response.Failed(_errorService.GetError(ErrorType.AccessDenied));

                return(response);
            }

            response = _taskCreator.CreateTaskGetListResponse(board.Tasks);
            response.Succeeded();

            return(response);
        }
Beispiel #2
0
        public TaskGetListResponse CreateTaskGetListResponse(IEnumerable <Task> tasks)
        {
            var response = new TaskGetListResponse
            {
                Data = tasks.Select(CreateDto)
            };

            return(response);
        }