public async Task <IViewComponentResult> InvokeAsync() { var notifications = await Task.FromResult(_notificator.ListAllNotifications()); notifications.ForEach(n => ViewData.ModelState.AddModelError(string.Empty, n.Message)); return(View()); }
protected ActionResult CustomResponse(object result = null) { if (IsValid()) { return(Ok(new { success = true, data = result })); } return(BadRequest(new { success = false, errors = _notificator.ListAllNotifications().Select(n => n.Message) })); }