Exemple #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;
            }
        }
Exemple #2
0
        public ManageJournalistsViewModel(Newspaper newspaper, INewspaperService newspaperService) : this()
        {
            Info = new NewspaperInfoViewModel(newspaper, newspaperService);

            foreach (var journalist in newspaper.NewspaperJournalists.ToList())
            {
                Journalists.Add(new JournalistForManageViewModel(journalist));
            }
        }
        public ManageArticlesViewModel(Newspaper newspaper, IList <Article> articles, INewspaperService newspaperService, PagingParam pagingParam)
        {
            Info = new NewspaperInfoViewModel(newspaper, newspaperService);

            foreach (var article in articles)
            {
                Articles.Add(new ArticleForManagementViewModel(article));
            }

            PagingParam = pagingParam;
        }
Exemple #4
0
 public ViewNewspaperViewModel(Newspaper newspaper, INewspaperService newspaperService)
 {
     Info = new NewspaperInfoViewModel(newspaper, newspaperService);
     foreach (var article in newspaper.Articles
              .OrderByDescending(a => a.ID)
              .Where(a => a.Published)
              .Take(10)
              .ToList())
     {
         LastArticles.Add(new ArticleShortViewModel(article));
     }
 }
 public WriteArticleViewModel(Newspaper newspaper, INewspaperService newspaperService)
 {
     Info = new NewspaperInfoViewModel(newspaper, newspaperService);
     PriceCurrencySymbol = Persistent.Countries.GetById(newspaper.CountryID).Currency.Symbol;
     NewspaperTax        = (double)newspaper.Country.CountryPolicy.ArticleTax * 100.0;
 }
 public ChangeNewspaperOwnerViewModel(Newspaper newspaper, INewspaperService newspaperService) : this()
 {
     Info = new NewspaperInfoViewModel(newspaper, newspaperService);
 }