/// <summary> /// 创建一个用户 /// </summary> /// <param name="usr">要创建的用户信息</param> /// <returns>创建是否成功</returns> public static string CreateUser(User usr) { if (!UserCheck.CheckUsername(usr.name)) { return("用户名格式不对"); } if (!UserCheck.CheckUserpswd(usr.password)) { return("用户密码格式不对"); } int result = int.Parse((string)Request.HttpRequest(usr, "PATCH", "CreateUser")); return(result.ToString());//ID }
/// <summary> /// 更新用户 /// </summary> /// <param name="usr">要更新的用户信息</param> /// <returns>更新是否成功</returns> public static string UpdateUser(User usr) { if (!UserCheck.CheckUsername(usr.name)) { return("用户名格式不对"); } if (!UserCheck.CheckUserpswd(usr.password)) { return("用户密码格式不对"); } string result = (string)Request.HttpRequest(usr, "PUT", "UpdateUser"); if (result == "true") { return("true"); } else { return("false"); } }