fix(#I177E5): 修复 MongoDB 无法保存新建项

#Comment
MongoDB 主键设置为 null

#Issue
close https://gitee.com/LongbowEnterprise/dashboard/issues?id=I177E5
This commit is contained in:
Argo Window10 2019-12-23 18:36:52 +08:00
parent 2a84ecf4f4
commit 22ed63278a
4 changed files with 4 additions and 0 deletions

View File

@ -41,6 +41,7 @@ namespace Bootstrap.DataAccess.MongoDB
{
if (string.IsNullOrEmpty(p.Id))
{
p.Id = null;
DbManager.Dicts.InsertOne(p);
p.Id = DbManager.Dicts.Find(d => d.Name == p.Name && d.Category == p.Category && d.Define == p.Define && d.Code == p.Code).FirstOrDefault().Id;
}

View File

@ -33,6 +33,7 @@ namespace Bootstrap.DataAccess.MongoDB
{
if (string.IsNullOrEmpty(p.Id))
{
p.Id = null;
DbManager.Groups.InsertOne(new Group()
{
GroupCode = p.GroupCode,

View File

@ -56,6 +56,7 @@ namespace Bootstrap.DataAccess.MongoDB
{
if (string.IsNullOrEmpty(p.Id))
{
p.Id = null;
DbManager.Menus.InsertOne(p);
p.Id = DbManager.Menus.Find(m => m.Name == p.Name && m.Category == p.Category && m.ParentId == p.ParentId && m.Url == p.Url).FirstOrDefault().Id;
}

View File

@ -38,6 +38,7 @@ namespace Bootstrap.DataAccess.MongoDB
{
if (string.IsNullOrEmpty(p.Id))
{
p.Id = null;
DbManager.Roles.InsertOne(new Role()
{
RoleName = p.RoleName,