protected void NotifyModelStateErrors() { foreach (var error in ModelState.Values.SelectMany(e => e.Errors)) { _domainNotificationHandler.AddNotification(new ModelErrorNotification(error.ErrorMessage)); } }
protected async Task <IActionResult> CreateCommandResponse <TCommand>(TCommand command) where TCommand : IRequest <CommandResult> { CommandResult result = await _mediator.Send(command); if (!result.Success) { foreach (DomainNotification notification in result.Notifications) { _domainNotificationHandler.AddNotification(notification.Title, notification.Description); } } return(CreateResponse()); }
protected void NotificarValidacoesErro(ValidationResult validarionResult) { foreach (var erro in validarionResult.Errors) { _notifications.AddNotification(new DomainNotification(erro.PropertyName, erro.ErrorMessage)); } }
public async Task <StockTransactionVM> GetAsync(string id) { StockTransaction transaction = await _mediator.Send(new GetSingleRequest <StockTransaction>(id)); if (transaction == null) { _notifications.AddNotification("404", "stock transaction was not found."); } return(transaction.ToVM()); }
public IViewComponentResult Invoke() { var notificationJson = TempData["SuccessNotification"]; if (notificationJson != null) { var successNotification = JsonConvert.DeserializeObject <CommandSuccessNotification>(notificationJson.ToString(), new JsonSerializerSettings { Converters = new List <JsonConverter> { new SuccessNotificationJsonConverter() } }); if (successNotification != null) { _domainNotificationHandler.AddNotification(successNotification); } } var notifications = _domainNotificationHandler.GetNotifications(); return(View(notifications)); }
public void AddNotification(string title, string description) { _domainNotificationHandler.AddNotification(title, description); }
protected void AddNotification(string title, string description) { _domainNotificationHandler.AddNotification(new DomainNotification(title, description)); }
protected void AddNotification(string title, string description) { _logger.LogWarning("Notificação adicionada: {notification}", new { title, description }); _domainNotificationHandler.AddNotification(title, description); }