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(); }
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(); }
public RatingLink(IRatingLink data) : base(data, typeof(IRatingLink)) { }