public void TestMethod1() { var bll = new CustomerInfoBLL(); var rs = bll.GetModel(1); Assert.IsNotNull(rs, "失败"); }
public object Put([FromBody] CustomerInfo model) { if (string.IsNullOrWhiteSpace(model.CustomerAccount) || string.IsNullOrWhiteSpace(model.CustomerName) || string.IsNullOrWhiteSpace(model.CustomerPwd)) { return(new { result = Result.ValueCanNotBeNull }); } if (!Regex.IsMatch(model.CustomerAccount, @"^[a-zA-Z_]\w{3,16}")) { return(new { result = Result.AccountOnlyConsistOfLettersAndNumbers }); } if (!Regex.IsMatch(model.CustomerName, @"^[\u0391-\uFFE5a-zA-Z_]\w{3,16}")) { return(new { result = Result.AccountOnlyConsistOfLettersAndNumbers }); } CustomerInfo mi = CustomerInfoBLL.GetModel(model); if (mi != null) { return(new { result = Result.AccountHasBeenRegistered }); } model.CustomerState = 0; model.CustomerPwd = Utils.MD5(model.CustomerPwd); model.CreateDate = DateTime.Now; int result = CustomerInfoBLL.Add(model); if (result > 0) { return(new { result = 0 }); } return(new { result = 4 }); }