特性[Required] (必修的)
////// 操作人EmpID/// [Required]public string OptEmpID { get; set; } //验证方式if (!ModelState.IsValid){ StringBuilder errinfo = new StringBuilder(); foreach (var s in ModelState.Values) { foreach (var p in s.Errors) { errinfo.AppendFormat("{0}\\n", p.ErrorMessage); } }
return errinfo.ToString(); }
return errinfo.ToString();