예제 #1
0
        public static ActionResult AsError(params string[] errors)
        {
            var result = new ActionResult(true);

            foreach (var error in errors)
            {
                result.WithError(error);
            }

            return result;
        }
예제 #2
0
        public static ActionResult AsErrorOnValidation(ModelValidationResult validationResult)
        {
            var result = new ActionResult(false);

            foreach (var error in validationResult.Errors)
            {
                foreach (var member in error.MemberNames)
                {
                    result.WithError(error.GetMessage(member));
                }
            }

            return result;
        }