增加功能:MongoDB增加保存日志功能

This commit is contained in:
Argo-MacBookPro 2018-10-30 16:30:58 +08:00
parent 2e31c31285
commit b008a8c46c
1 changed files with 12 additions and 0 deletions

View File

@ -18,5 +18,17 @@ namespace Bootstrap.DataAccess.MongoDB
var log = MongoDbAccessManager.DBAccess.GetCollection<DataAccess.Log>("Logs");
return log.Find(l => l.LogTime >= DateTime.Now.AddDays(-7)).ToList();
}
/// <summary>
///
/// </summary>
/// <param name="log"></param>
/// <returns></returns>
public override bool SaveLog(DataAccess.Log log)
{
var logs = MongoDbAccessManager.DBAccess.GetCollection<DataAccess.Log>("Logs");
log.LogTime = DateTime.Now;
logs.InsertOne(log);
return true;
}
}
}