重构代码:Dict.cs文件重构,更正xml描述参数,更改Linq写法

This commit is contained in:
Argo Zhang 2019-03-06 15:28:30 +08:00
parent 25e77b607f
commit 76cdb775e6
1 changed files with 3 additions and 6 deletions

View File

@ -1,4 +1,4 @@
using Bootstrap.Security;
using Bootstrap.Security;
using Bootstrap.Security.DataAccess;
using System;
using System.Collections.Generic;
@ -43,9 +43,7 @@ namespace Bootstrap.DataAccess
/// <summary>
/// 保存网站个性化设置
/// </summary>
/// <param name="name"></param>
/// <param name="code"></param>
/// <param name="category"></param>
/// <param name="dict"></param>
/// <returns></returns>
public virtual bool SaveSettings(BootstrapDict dict)
{
@ -83,7 +81,7 @@ namespace Bootstrap.DataAccess
/// <returns></returns>
public virtual string RetrieveActiveTheme()
{
var theme = DictHelper.RetrieveDicts().Where(d => d.Name == "使用样式" && d.Category == "当前样式" && d.Define == 0).FirstOrDefault();
var theme = DictHelper.RetrieveDicts().FirstOrDefault(d => d.Name == "使用样式" && d.Category == "当前样式" && d.Define == 0);
return theme == null ? string.Empty : (theme.Code.Equals("site.css", StringComparison.OrdinalIgnoreCase) ? string.Empty : theme.Code);
}
@ -126,7 +124,6 @@ namespace Bootstrap.DataAccess
/// <summary>
/// 通过数据库获得所有字典表配置信息缓存Key=DictHelper-RetrieveDicts
/// </summary>
/// <param name="db">数据库连接实例</param>
/// <returns></returns>
public virtual IEnumerable<BootstrapDict> RetrieveDicts() => DbHelper.RetrieveDicts();
}