我在#is; isActive提交的文件中收到错误"并在catch错误消息中说
"反序列化类TimeClock.Model.UserModel的isActive属性时发生错误:无法反序列化'字符串'来自BsonType'布尔'。"
<script
src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.20.1/moment.min.js">
</script>
以下是我的List<UserModel> lstemployee = new List<UserModel>();
UserModel employee = new UserModel();
try
{
Connection cn = new Connection();
IMongoDatabase server = cn.ConnectionString();
var collection = server.GetCollection<UserModel>("users");
// ObjectId id = ObjectId.Parse(ObjParam._id);
var email = ObjParam.email_id;
var builder = Builders<UserModel>.Filter;
var filter = builder.Eq( "email_id", email);
var obj = collection.Find(filter).ToListAsync();
if (obj != null && obj.Result != null)
{
lstemployee = obj.Result.Select(x => new UserModel()
{
_id = Convert.ToString(x._id),
user_id = x.user_id,
role_id = x.role_id,
first_name = x.first_name,
last_name = x.last_name,
email_id = x.email_id,
user_name = x.user_name,
password = x.password,
gender = x.gender,
birth_date = x.birth_date,
cell_phone = x.cell_phone,
address = x.address,
access_level = x.access_level,
security_question = x.security_question,
security_answer = x.security_answer,
business_id = x.business_id,
created_by = x.created_by,
created_date = x.created_date,
modified_by = x.modified_by,
modified_date = x.modified_date,
isActive = x.isActive.ToString()
}).ToList();
课程
usermodel