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 NewspaperIndexViewModel(List <Newspaper> newspapers, INewspaperService newspaperService) { foreach (var newspaper in newspapers) { Newspapers.Add(new NewspaperInfoViewModel(newspaper, newspaperService)); } }
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 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, Article article, INewspaperService newspaperService) : this(newspaper, newspaperService) { Content = article.Content; Title = article.Title; PayOnlyContent = article.PayOnlyContent; ShortDescription = article.ShortDescription; EnablePayOnly = article.Price.HasValue; Price = (double?)article.Price; ImgUrl = article.ImgURL; Edit = true; ID = article.ID; Publish = article.Published; }
public NewspaperController(INewspaperService newspaperService, INewspaperRepository newspaperRepository, IArticleRepository articleRepository, ICitizenRepository citizenRepository, IUploadService uploadService, IWalletService walletService, IEquipmentRepository equipmentRepository, IConfigurationRepository configurationRepository , IPopupService popupService, IEntityRepository entityRepository) : base(popupService) { this.newspaperService = newspaperService; this.newspaperRepository = newspaperRepository; this.articleRepository = articleRepository; this.citizenRepository = citizenRepository; this.uploadService = uploadService; this.walletService = walletService; this.equipmentRepository = equipmentRepository; this.configurationRepository = configurationRepository; this.entityRepository = entityRepository; }
public NewspaperInfoViewModel(Newspaper newspaper, INewspaperService newspaperService) : base(newspaper.Entity) { CountryName = newspaper.Country.Entity.Name; CountryID = newspaper.CountryID; NewspaperRights = newspaperService.GetNewspaperRights(newspaper, SessionHelper.CurrentEntity, SessionHelper.LoggedCitizen); var productRepository = DependencyResolver.Current.GetService <IProductRepository>(); InventoryCapacity = newspaper.Entity.Equipment.ItemCapacity; PaperCount = newspaper.Entity.GetEquipmentItem(ProductTypeEnum.Paper, 1, productRepository).Amount; var owner = newspaper.Owner; OwnerID = owner.EntityID; OwnerName = owner.Name; CanSwitch = NewspaperRights == NewspaperRightsEnum.Full; createMenu(); AvatarChange = new AvatarChangeViewModel(newspaper.ID); }
public UploadAvatarService(IUploadRepository uploadRepository, ICompanyService companyService, INewspaperService newspaperService, IPartyService partyService) : base(uploadRepository) { this.companyService = companyService; this.newspaperService = newspaperService; this.partyService = partyService; }
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); }
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; }