Esempio n. 1
0
        public Notification AsNotification()
        {
            var notification = new Notification();

            notification.Add(Message, Severity);
            return(notification);
        }
        public static Notification Error(string errorMessage)
        {
            var retNotification = new Notification();

            retNotification.Add(errorMessage);
            return(retNotification);
        }
        public Notification ValidateModel(T instance)
        {
            Notification result = new Notification();

            if (instance != null)
            {
                var validationResult = Validate(instance);

                foreach (var error in validationResult.Errors)
                {
                    NotificationItem errorItem = new NotificationItem(error.ErrorMessage, NotificationSeverity.Error)
                    {
                        Reference = error.PropertyName
                    };
                    result.Add(errorItem);
                }
            }

            return(result);
        }