Example #1
0
        public ArticleViewModel(ArticleDom article, Newspaper newspaper, INewspaperService newspaperService, PagingParam pagingParam)
        {
            Info           = new NewspaperInfoViewModel(newspaper, newspaperService);
            CurrencySymbol = Persistent.Countries.GetCountryCurrency(newspaper.CountryID).Symbol;

            ID               = article.ArticleID;
            Score            = parseScore(article.VoteScore);
            Title            = article.Title;
            Content          = article.Content;
            HasPayContent    = article.Price.HasValue;
            PayOnlyContent   = article.PaidContent;
            Price            = (double?)article.Price;
            CanSeePayContent = article.UnlockedContent;
            CanVote          = SessionHelper.CurrentEntity.GetEntityType() == Entities.enums.EntityTypeEnum.Citizen;

            foreach (var comment in article.Comments.OrderBy(comment => comment.CreationDate))
            {
                Comments.Add(new ArticleCommentViewModel(comment));
            }

            PagingParam = pagingParam;

            VoteScore = newspaperService.GetVoteScore(ID, SessionHelper.CurrentEntity);

            if (Price != null)
            {
                var policy = newspaper.Country.CountryPolicy;
                var tax    = 1 + (double)policy.ArticleTax;

                Price *= tax;
            }
        }
 public HomeArticleSpotlightViewModel(ArticleDom article)
 {
     ID           = article.ArticleID;
     Day          = article.CreationDay;
     CountryFlag  = Images.GetCountryFlag(article.CountryID).VM;
     ArticleImage = new ImageViewModel(article.ImgURL);
     Title        = article.Title;
     Score        = ScoreHelper.ToString(article.VoteScore);
 }