public async Task <bool> Handle(RemoveTemplateCommand request, CancellationToken cancellationToken) { if (!request.IsValid()) { NotifyValidationErrors(request); return(false); } var template = await _templateRepository.GetByName(request.Name); if (template == null) { await Bus.RaiseEvent(new DomainNotification("Template", "Template not found.")); return(false); } _templateRepository.Remove(template.Id); if (await Commit()) { await Bus.RaiseEvent(new TemplateRemovedEvent(template.Id)); return(true); } return(false); }
private void UpdateCommands() { RemoveTemplateCommand.RaiseCanExecuteChanged(); SaveCommand.RaiseCanExecuteChanged(); UpdateTemplateCommand.RaiseCanExecuteChanged(); }