12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using Microsoft.AspNetCore.Mvc;
- using MySystem.BsModels;
- namespace MySystem
- {
- public class PageUpdateInfoDictionary
- {
- WebCMSEntities db = new WebCMSEntities();
- #region 页面模板字典
- public Dictionary<string, string> getPageUpdateInfoDic(string Kind = "default")
- {
- List<PageUpdateInfo> PageUpdateInfoList = db.PageUpdateInfo.Where(m => m.SeoKeyword == Kind).OrderBy(m => m.ModulePath).ToList();
- Dictionary<string, string> PageUpdateInfoDic = new Dictionary<string, string>();
- foreach (PageUpdateInfo subPageUpdateInfo in PageUpdateInfoList)
- {
- PageUpdateInfoDic.Add(subPageUpdateInfo.ModulePath.Replace(".html", ""), subPageUpdateInfo.Title+subPageUpdateInfo.ModulePath.Replace(".html", ""));
- }
- return PageUpdateInfoDic;
- }
- #endregion
- #region 根据字典key获取字典值
- public string getDictionaryNameByKey(Dictionary<string, string> data, string key)
- {
- if (data.ContainsKey(key))
- {
- return data[key];
- }
- return "";
- }
- public string getDictionaryNameById(Dictionary<int, string> data, int key)
- {
- if (data.ContainsKey(key))
- {
- return data[key];
- }
- return "";
- }
- public string getDictionaryNamesByKeys(Dictionary<string, string> data, string keys)
- {
- string result = "";
- string[] keylist = keys.Split(',');
- foreach (string subkey in keylist)
- {
- if (data.ContainsKey(subkey))
- {
- result += data[subkey] + ",";
- }
- }
- return result.TrimEnd(',');
- }
- #endregion
- }
- }
|