コード例 #1
0
        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);
        }
コード例 #2
0
 private void UpdateCommands()
 {
     RemoveTemplateCommand.RaiseCanExecuteChanged();
     SaveCommand.RaiseCanExecuteChanged();
     UpdateTemplateCommand.RaiseCanExecuteChanged();
 }