Example #1
0
        public string ErrorMessages()
        {
            string message = string.Empty;

            var obj = "";

            if (!IsValid)
            {
                if (ValidationResults != null && ValidationResults.Count > 0)
                {
                    IEnumerator <ValidationResult> results = ValidationResults.GetEnumerator();

                    while (results.MoveNext())
                    {
                        ValidationResult vr = results.Current;
                        if (vr != null)
                        {
                            message += vr.ErrorMessage + System.Environment.NewLine;
                        }
                    }
                }

                obj = JsonConvert.SerializeObject(message, new JsonSerializerSettings());
            }

            return(obj);
        }
        public string ErrorMessages()
        {
            string message = string.Empty;

            if (!IsValid)
            {
                if (ValidationResults != null &&
                    ValidationResults.Count > 0)
                {
                    IEnumerator <ValidationResult> results =
                        ValidationResults.GetEnumerator();
                    while (results.MoveNext())
                    {
                        ValidationResult vr = results.Current;
                        message += vr.ErrorMessage + System.Environment.NewLine;
                    }
                }
            }

            return(message);
        }