Example #1
0
        public List <Banner> GetBannerListByPosAsync(EnumBannerPos pos, int topCount = 20)
        {
            if (topCount == 0)
            {
                return(null);
            }

            return(_bannerRepository.GetBannerListByPosAsync(pos, topCount));
        }
Example #2
0
 public List <Banner> GetListByPosAsync(EnumBannerPos pos = EnumBannerPos.Index)
 {
     using (var conn = DapperFactory.GetConnection())
     {
         string sql  = "select * from [Banner] where Pos = @Pos and Status=1;";
         var    list = conn.Query <Banner>(sql, new { Pos = pos });
         return(list != null?list.ToList() : null);
     }
 }
Example #3
0
 public List <Banner> GetBannerListByPosAsync(EnumBannerPos pos, int topCount)
 {
     using (var conn = DapperFactory.GetConnection())
     {
         string sql  = string.Format("select top {0} Id,Title,Type,ImageUrl,VideoUrl,Link from Banner where Pos=@Pos and IsShow=1 and Status=1 order by GroupIndex;", topCount);
         var    list = conn.Query <Banner>(sql, new { Pos = pos.ToInt32() });
         return(list != null?list.ToList() : null);
     }
 }
Example #4
0
        public static List <Banner> GetBannerList(EnumBannerPos pos)
        {
            var list = AutofacService.Resolve <IBannerService>().GetBannerListByPosAsync(pos);

            if (list != null && list.Count > 0)
            {
                return(list);
            }

            list = AutofacService.Resolve <IBannerService>().GetBannerListByPosAsync(EnumBannerPos.Index);   // 如果页面没有banner配置,默认给index的banner配置
            return(list ?? new List <Instart.Models.Banner>());
        }
Example #5
0
 public List <Banner> GetListByPosAsync(EnumBannerPos pos = EnumBannerPos.Index)
 {
     return(_bannerRepository.GetListByPosAsync(pos));
 }