public ActionResult Edit(StoreInfo info) { StoreInfo infoExist = StoreBLL.GetList(p => p.Name == info.Name && p.ID != info.ID).FirstOrDefault(); if (infoExist != null) { return(Json(new APIJson(-1, "名称已存在"))); } if (string.IsNullOrEmpty(info.Name)) { return(Json(new APIJson(-1, "名称未填写"))); } if (string.IsNullOrEmpty(info.Name.Trim())) { return(Json(new APIJson(-1, "名称不能是空格,请正确填写"))); } if (null == info.IP) { info.IP = string.Empty; } infoExist = StoreBLL.GetList(p => p.ID == info.ID).FirstOrDefault(); if (null == infoExist) { return(Json(new APIJson(-1, "parms error"))); } if (!string.IsNullOrEmpty(info.Password)) { bool IsPassWordValidate = ValidatePassWord(info); if (!IsPassWordValidate || info.Password.Length < 8 || info.Password.Length > 16) { return(Json(new APIJson("密码必需包含数字、字母,并且长度在8到16位"))); } infoExist.Password = Tool.Md5Helper.Md5(info.Password); } infoExist.Name = info.Name; infoExist.Code = info.Code; infoExist.IP = info.IP; if (StoreBLL.Edit(infoExist)) { return(Json(new APIJson(0, "提交成功"))); } return(Json(new APIJson(-1, "提交失败"))); }