Пример #1
0
        public AdPosition GetByPosKeyCache(AdPosKey value)
        {
            var result = Cache.Get(string.Format(GetByPosKeyCacheKey, value), () =>
            {
                var model = QueryUnDelete().FirstOrDefault(m => m.Code == value);
                return(model ?? new AdPosition());
            });

            return(result);
        }
        public AdPosition GetByPosKeyCache(AdPosKey value)
        {
            var result = Cache.Get(string.Format(GetByPosKeyCacheKey, value), (Func <AdPosition>)(() =>
            {
                var sql   = $"{base.Query()} and Code = @code";
                var model = DbConn.QueryFirstOrDefault <AdPosition>(sql, new { code = value });
                return(model ?? new AdPosition());
            }));

            return(result);
        }
Пример #3
0
        public static Advert CreateAdvert(long adPosId, AdPosKey code, string adPosName)
        {
            var advert = new Advert
            {
                AdPosId      = adPosId,
                Code         = code,
                StartTime    = DateTime.Now,
                AdvertStatus = AdvertStatus.Draft,
                AdType       = AdvertType.Img,
                AdPosName    = adPosName,
                CommonStatus = CommonStatus.Enabled
            };

            return(advert);
        }
Пример #4
0
 public static void ShowAdvert(this HtmlHelper helper, AdPosKey key, AdvertType?type = null, int takeSize = 0)
 {
     helper.RenderAction("AdPosDisplay", "Advert", new { key, type, takeSize });
 }