Exemplo n.º 1
0
        public virtual void Delete(int id)
        {
            var item     = Get(id);
            var children = GetChildWorkItems(id);

            if (children.Any())
            {
                throw new PmsException("Невозможно удалить элемент, у которого есть дочерние элементы");
            }
            _repository.Delete(item);
            _repository.SaveChanges();
        }
Exemplo n.º 2
0
        public async Task Delete(int workItemId)
        {
            var oldWorkItem = await GetHistoryById(workItemId);

            var filesToDelete = await GetAttachedById(workItemId);

            await _fileUploader.DeleteFromAzureAsync(filesToDelete);

            await _workItemRepository.Delete(workItemId);

            await _bus.Publish(new WorkItemDeleted
            {
                WorkItemId  = workItemId,
                OldWorkItem = oldWorkItem
            });
        }