public Task <bool> Handle(AlterarTipoAppCommand message, CancellationToken cancellationToken) { #region Basic Validation if (!message.IsValid()) { NotifyValidationErrors(message); return(Task.FromResult(false)); } #endregion #region Others validations var tipoApp = _tipoAppRepository.ObterPorNome(message.Nome); if (tipoApp != null && tipoApp.Nome.ToUpper().Equals(message.Nome.ToUpper()) && !tipoApp.Id.Equals(message.Id)) { _bus.RaiseEvent(new DomainNotification(message.MessageType, "Já existe um tipo de app com este nome")); } #endregion tipoApp = new TipoApp(message.Id, message.Nome, message.Descricao); _tipoAppRepository.Update(tipoApp); if (Commit()) { _bus.RaiseEvent(new AlterarTipoAppEvent()); } return(Task.FromResult(true)); }
public Task <bool> Handle(AlterarTipoAppCommand message, CancellationToken cancellationToken) { #region Basic Validation if (!message.IsValid()) { NotifyValidationErrors(message); return(Task.FromResult(false)); } #endregion if (Commit()) { _bus.RaiseEvent(new AlterarPerfilEvent()); } return(Task.FromResult(true)); }