public async Task <IActionResult> Add(Users users) { bool res = false; users.UpdateDate = DateTime.Now; if (users.Id > 0) { var data = await _usersServices.QueryByID(users.Id); if (data == null) { return(Error("修改用户失败,未找到该用户。")); } else { res = await _usersServices.Update(users, null, new List <string> { "Password" }); } } else { var data = await _usersServices.QueryByClause(m => m.UserName == users.UserName); if (data != null) { return(Error("登录姓名:" + users.UserName + "已经存在!")); } users.Password = Util.Helpers.Encrypt.Md5By32("123456"); res = await _usersServices.Add(users); } if (res) { return(Success("保存成功")); } else { return(Error("保存失败")); } }