Пример #1
0
        public async Task <IEnumerable <Contract.Models.Status> > GetByFolder(string folderId)
        {
            if (!await _folderGetOperations.ExistsById(folderId))
            {
                throw new NotFoundException("Директория не найдена");
            }

            return(await _taskStatusGetOperations.ByFolder(folderId));
        }
Пример #2
0
        public async Task <Contract.Models.Folder> DeleteFolder(string id, bool safeDelete = true)
        {
            if (!await _folderGetOperations.ExistsById(id))
            {
                throw new NotFoundException("Директория не найдена");
            }

            await _taskStatusWriteOperations.DeleteAllFromFolder(id);

            return(safeDelete
                ? await _folderWriteOperations.SafeDelete(id)
                : await _folderWriteOperations.Delete(id));
        }
Пример #3
0
        public async Task <Contract.Models.Issue> Create(CreateIssueDto createIssueDto)
        {
            ValidationHelper.ValidateAndThrow(createIssueDto);
            if (!await _folderGetOperations.ExistsById(createIssueDto.FolderId))
            {
                throw new NotFoundException("Директория не найдена");
            }

            if (!await _taskStatusGetOperations.ExistsById(createIssueDto.StatusId))
            {
                throw new NotFoundException("Статус не найден");
            }

            var model = new Contract.Models.Issue()
            {
                Id          = Guid.NewGuid().ToString(),
                Name        = createIssueDto.Name,
                Description = createIssueDto.Description,
                ExternalId  = createIssueDto.ExternalId,
                FolderId    = createIssueDto.FolderId,
                StatusId    = createIssueDto.StatusId
            };

            return(await _issueWriteOperations.Create(model));
        }