Пример #1
0
        public async Task <IViewComponentResult> InvokeAsync()
        {
            var notifications = await Task.FromResult(_notificator.ListAllNotifications());

            notifications.ForEach(n => ViewData.ModelState.AddModelError(string.Empty, n.Message));

            return(View());
        }
Пример #2
0
        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)
            }));
        }