Exemple #1
0
        public async Task <MessageModel <List <AdvertisementModel> > > GetAdvertiseList(string site)
        {
            var data = new MessageModel <List <AdvertisementModel> >();
            // todo

            var ads = _cacheHelper.Get <List <AdvertisementModel> >(SystemConst.PREF_ADVERTISEMENT + site);

            if (ads == null)
            {
                var addbs = await _advertisementServices.GetAdvertisementByOwner(site);

                if (null != addbs)
                {
                    ads = new List <AdvertisementModel>();
                    addbs.ForEach(u => ads.Add(u.ToViewModel()));
                    _cacheHelper.Set(SystemConst.PREF_ADVERTISEMENT + site, ads, DateTime.Now.AddMonths(1));
                }
            }
            data.response = ads;
            return(data);
        }