12345678910111213141516171819202122232425262728293031323334353637383940 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using MySystem.Models.Models;
- namespace MySystem
- {
- public class AdvertismentDbconn
- {
- public readonly static AdvertismentDbconn Instance = new AdvertismentDbconn();
- #region 获取列表
- public List<Advertisment> GetList(string ColId)
- {
- // string key = "AdvertismentList:" + ColId;
- // List<Advertisment> list = new List<Advertisment>();
- // if (RedisDbconn.Instance.Exists(key))
- // {
- // list = RedisDbconn.Instance.GetList<Advertisment>(key);
- // if (list.Count > 0)
- // {
- // return list;
- // }
- // }
- List<Advertisment> newlist = new List<Advertisment>();
- WebCMSEntities db = new WebCMSEntities();
- var mysqllist = db.Advertisment.Where(m => m.ColId == ColId).OrderByDescending(m => m.Sort).OrderByDescending(m => m.Id).ToList();
- if (mysqllist.Count > 0)
- {
- foreach (var sub in mysqllist)
- {
- newlist.Add(sub);
- }
- }
- db.Dispose();
- return newlist;
- }
- #endregion
- }
- }
|