public static void AddModelError(this ModelStateDictionary modelState, CodeRunResult crr) { if (crr == null) { return; } foreach (var err in crr.ErrorMessages) { modelState.AddModelError("", err); } foreach (var err in crr.Exceptions) { modelState.AddModelError("", err); modelState.AddModelError("", err.Message); } }
public static void AddModelStateError(this Controller ctrl, CodeRunResult crr) { ctrl.ModelState.AddModelError(crr); }