public static ActionResult AsError(params string[] errors) { var result = new ActionResult(true); foreach (var error in errors) { result.WithError(error); } return result; }
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; }