/// <summary> /// 删除域 /// </summary> public static ResultKey DeleteDomain(Domain entry) { if (entry == null) { return(ResultKey.Failure); } return(repository.Delete(entry)); }
/// <summary> /// Deletes a domain. /// </summary> /// <param name="tenantId">Identifies website whose domain is to deleted.</param> /// <param name="domainId">Identifies the domain to delete.</param> /// <param name="unitOfWork">Unit of work.</param> public void Delete(long tenantId, long domainId, IUnitOfWork unitOfWork = null) { try { _domainRepository.Delete(tenantId, domainId, unitOfWork); } catch (ValidationErrorException) { throw; } catch (Exception ex) { throw new ValidationErrorException(new ValidationError(null, ApplicationResource.UnexpectedErrorMessage), ex); } }
public bool Invoke(Guid domainId) { if (domainId == Guid.Empty) { return(false); } var domainToDelete = domainRepository.GetById(domainId); if (domainToDelete == null) { return(false); } domainRepository.Delete(domainToDelete); _unitOfWork.Save(); return(true); }
public async Task <Unit> Handle(DeleteDocumentCommand request, CancellationToken cancellationToken) { if (request == null) { throw new ArgumentNullException(nameof(request)); } var document = await domainRepository.GetDocumentByLocation(request.FileLocation); if (document == null) { throw new ValidationException($"Document with Location: {request.FileLocation} doesn't exist."); } await fileRepository.DeleteFile(document.Name, cancellationToken); await domainRepository.Delete(document, cancellationToken); return(Unit.Value); }
public Attempt <OperationResult> Delete(IDomain domain) { EventMessages eventMessages = EventMessagesFactory.Get(); using (IScope scope = ScopeProvider.CreateScope()) { var deletingNotification = new DomainDeletingNotification(domain, eventMessages); if (scope.Notifications.PublishCancelable(deletingNotification)) { scope.Complete(); return(OperationResult.Attempt.Cancel(eventMessages)); } _domainRepository.Delete(domain); scope.Complete(); scope.Notifications.Publish(new DomainDeletedNotification(domain, eventMessages).WithStateFrom(deletingNotification)); } return(OperationResult.Attempt.Succeed(eventMessages)); }
public Attempt <OperationResult> Delete(IDomain domain) { var evtMsgs = EventMessagesFactory.Get(); using (var scope = ScopeProvider.CreateScope()) { var deleteEventArgs = new DeleteEventArgs <IDomain>(domain, evtMsgs); if (scope.Events.DispatchCancelable(Deleting, this, deleteEventArgs)) { scope.Complete(); return(OperationResult.Attempt.Cancel(evtMsgs)); } _domainRepository.Delete(domain); scope.Complete(); deleteEventArgs.CanCancel = false; scope.Events.Dispatch(Deleted, this, deleteEventArgs); } return(OperationResult.Attempt.Succeed(evtMsgs)); }
public void DeleteDomain(int id) { _domainRepository.Delete(id); }
public override void Handle(DeleteAggregateRoot <TRoot> command) { _repo.Delete(command.Id); }