public bool Validate(FormField field, FormDataItem data, out string message) { message = string.Empty; if (field.Name == "ValidCode" && data.FieldValue.IsNotNullAndWhiteSpace()) { string code = _validate.GetCode(); if (!code.Equals(data.FieldValue, StringComparison.InvariantCultureIgnoreCase)) { message = _localize.Get("{0}不正确").FormatWith(field.DisplayName); return(false); } } return(true); }
public ActionResult GetCode() { string code = _validateService.GetCode(); return(Content(code)); }