protected StandardJsonResult JsonError(string errorMessage) { var result = new StandardJsonResult { JsonRequestBehavior = JsonRequestBehavior.AllowGet }; result.AddError(errorMessage); return(result); }
protected StandardJsonResult JsonValidationError() { var result = new StandardJsonResult { JsonRequestBehavior = JsonRequestBehavior.AllowGet }; foreach (var validationError in ModelState.Values.SelectMany(v => v.Errors)) { result.AddError(validationError.ErrorMessage); } return(result); }