Ejemplo n.º 1
0
        public override void OnActionExecuted(ActionExecutedContext context)
        {
            if (Alert.GetAlerts().Any())
            {
                TempData.Put("alertMessages", Alert.GetAlerts());
            }

            if (Breadcrumb.GetBreadcrumbItems().Any())
            {
                ViewData.Add("breadcrumbItems", Breadcrumb.GetBreadcrumbItems());
            }

            if (!context.ModelState.IsValid)
            {
                foreach (var modelStateKey in ModelState.Keys)
                {
                    var modelStateVal = ModelState[modelStateKey];

                    foreach (var error in modelStateVal.Errors)
                    {
                        var key          = modelStateKey;
                        var errorMessage = error.ErrorMessage;
                        logger.Warning($"Key: {key}, Error: {errorMessage}");
                    }
                }
            }
        }
Ejemplo n.º 2
0
 public override void OnActionExecuted(ActionExecutedContext context)
 {
     base.OnActionExecuted(context);
     if (Alert.GetAlerts().Count > 0)
     {
         TempData.Add("alertMessages", Alert.GetAlerts());
     }
 }