Example #1
0
        public ActionResult Watch()
        {
            #region Parameter Verify
            string id = Request.QueryString[Const.VIDEOID].ToString();
            if (string.IsNullOrEmpty(id))
            {
                id = "8";
            }
            int ids = 0;
            if (!int.TryParse(id, out ids))
            {
                return(View());
            }
            #endregion

            //Get Cache
            StartRecommendModel modelCache = CacheHelper.GetCacheBy(id) as StartRecommendModel;
            if (modelCache != null)
            {
                return(View(modelCache));
            }
            //if no cache,serach data from db,add to cache.
            StartRecommendModel model = _service.GetSpecialVideoBy(ids);
            CacheHelper.AddCache(id, model);
            return(View(model));
        }
Example #2
0
        public StartRecommendModel GetSpecialVideoBy(int Id)
        {
            VideoEntity         entity = _video.Find(Id);
            StartRecommendModel model  = Mapper.Map <StartRecommendModel>(entity);

            return(model);
        }
Example #3
0
        public int InSert(StartRecommendModel model)
        {
            VideoEntity video = Mapper.Map <VideoEntity>(model);

            video.Publish(CurrenUser);
            return(_video.Insert(video));
        }
Example #4
0
        public void Update(StartRecommendModel model)
        {
            VideoEntity video      = _video.Find(model.Id);
            DateTime    createTime = video.CreateTime.Value;

            Mapper.Map(model, video);
            video.CreateTime = createTime;
            video.UpDate(CurrenUser);
        }