示例#1
0
        public RatingLinkModel(IRatingLink data)
        {
            _lookupRepository  = DependencyResolver.Current.GetService <ILookupRepository>();
            _articleRepository = DependencyResolver.Current.GetService <IArticleRepository>();

            this.Category    = new CategoryInfo(_lookupRepository.FetchCategoryInfo(data.CategoryId));
            this.ArticleType = new ArticleType(_articleRepository.FetchType(data.ArticleTypeId));
            this.Ratings     = data.RatingIds.Select(r => new RatingModel(r.Value)).ToList();
        }
示例#2
0
        public void CreateRatingLink(IRatingLink link)
        {
            var db = new TooksCmsDAL();

            db.DeleteRatingLinks(link.ArticleTypeId, link.CategoryId);
            foreach (var rating in link.RatingIds)
            {
                CreateRatingLink(db, rating.Value.RatingId, link.ArticleTypeId, link.CategoryId, rating.Key);
            }

            db.SaveChanges();
        }
示例#3
0
 public RatingLink(IRatingLink data) :
     base(data, typeof(IRatingLink))
 {
 }