修改BUG:MongoDB数据库Users类RetrieveUserByUserName方法缺失默认值设置 #IS2WS

This commit is contained in:
Argo-Surface 2019-02-27 19:16:09 +08:00
parent a9d3c78ff2
commit 5ea8022d3c
1 changed files with 9 additions and 2 deletions

View File

@ -33,8 +33,15 @@ namespace Bootstrap.DataAccess.MongoDB
.Include(u => u.UserName) .Include(u => u.UserName)
.Include(u => u.DisplayName) .Include(u => u.DisplayName)
.Include(u => u.Icon) .Include(u => u.Icon)
.Include(u => u.Css); .Include(u => u.Css)
return DbManager.Users.Find(user => user.UserName.ToLowerInvariant() == userName.ToLowerInvariant()).Project<DataAccess.User>(project).FirstOrDefault(); .Include(u => u.App);
var ret = DbManager.Users.Find(user => user.UserName.ToLowerInvariant() == userName.ToLowerInvariant()).Project<DataAccess.User>(project).FirstOrDefault();
if (ret != null)
{
if (string.IsNullOrEmpty(ret.Icon)) ret.Icon = "default.jpg";
if (string.IsNullOrEmpty(ret.App)) ret.App = "0";
}
return ret;
} }
/// <summary> /// <summary>