public ArticleViewModel(Article Article) { this.Comments = CommentCore.GetCommentByArticleId(Article.ID); this.LatestArticles = new List <LatestArticleRow>(); foreach (Article article in ArticleCore.GetMostRecentArticles(5)) { LatestArticles.Add(new LatestArticleRow(article.ID, article.Title, article.CreationDate)); } this.LatestContributors = new List <LatestContributorsRow>(); foreach (Contributor latestContributor in ContributorCore.GetLatestContributors(5)) { LatestContributors.Add(new LatestContributorsRow(latestContributor.ID, latestContributor.Name, latestContributor.TotalContributions, latestContributor.ImageURL)); } this.Affiliate = new Affiliate(); this.Affiliate = AffiliateCore.GetAffiliatesById(Article.AffiliateID); Article.ViewCount = Article.ViewCount + 1; ID = Article.ID; Title = Article.Title; CreationDate = Article.CreationDate; ViewCount = Article.ViewCount;//todo dbden arttır ArticleBody = GetArticleBody(ArticleCore.GetArticlePiecesByArticleId(Article.ID)); Contributor contributor = ContributorCore.GetContributorsById(Article.ContributorID); ContributorName = contributor.Name; ContributorImage = contributor.ImageURL; ContributorID = contributor.ID; }
public ContributorsViewModel(string keyword, string affiliate, string contributor, string country, string city, string page, List <City> cities, List <Country> countries) { this.FoundContributors = ContributorCore.GetFilteredContributors(keyword, affiliate, contributor, country, city, page); this.RelatedAffiliates = AffiliateCore.GetAffiliatesById(FoundContributors.Select(x => x.AffiliateID).ToList()); this.Cities = cities; this.Countries = countries; this.Keyword = keyword; }
public AffiliateViewModel(string id) { this.Affiliate = AffiliateCore.GetAffiliatesById(id); if (this.Affiliate == null) { this.Affiliate = new Affiliate(); } this.Contributors = ContributorCore.GetContributorsByAffiliateId(id); }
public IActionResult AddAffiliate(string id) { if (!string.IsNullOrEmpty(id)) { Affiliate affiliate = AffiliateCore.GetAffiliatesById(id); if (affiliate != null) { return(View(new AffiliateAddEditModel(affiliate))); } } return(View(new AffiliateAddEditModel())); }
public IActionResult AddContributor(string id) { if (!string.IsNullOrEmpty(id)) { Contributor contributor = ContributorCore.GetContributorsById(id); if (contributor != null) { Affiliate affiliate = AffiliateCore.GetAffiliatesById(contributor.AffiliateID); return(View(new ContributorAddEditModel(contributor, CacheItems.Countries, CacheItems.Cities, affiliate))); } } return(View(new ContributorAddEditModel())); }
public ContributorViewModel(Contributor contributor) { this.ContributorBio = contributor.Bio; this.ContributorName = contributor.Name; this.Affiliate = AffiliateCore.GetAffiliatesById(contributor.AffiliateID).Name; this.ContributorImageURL = contributor.ImageURL; this.Email = contributor.Email; this.ContributorArticles = new List <ContributorArticleRow>(); foreach (Article contributorArticle in ArticleCore.GetArticleByContributorId(contributor.ID, 5, 0)) { ContributorArticles.Add(new ContributorArticleRow(contributorArticle)); } this.TotalContributions = contributor.TotalContributions; }
public IndexViewModel(FilterModel FilterModel) { this.FilterModel = FilterModel; Article article = new Article(); //ArticleCore.GetMostPopularArticles() PopularArticles = ArticleCore.GetMostPopularArticles(5); RecentArticles = ArticleCore.GetMostRecentArticles(12); RecentContributors = ContributorCore.GetMostRecentContributors(10); List <string> ContributorIds = RecentArticles.Select(x => x.ContributorID).ToList(); ContributorIds.AddRange(PopularArticles.Select(x => x.ContributorID).ToList()); //Recent Articles'teki referans edilmiş adamları da ekliyorum RecentContributors.AddRange(ContributorCore.GetContributorsById(ContributorIds)); //Referans edilmiş şiretleri ekliyorum Affiliates = AffiliateCore.GetAffiliatesById(RecentContributors.Select(x => x.AffiliateID).ToList()); }
public ArticleSearchViewModel(FilterModel FilterModel, string affiliate, string practice, string contributor, string country, string city, string page) { this.FilterModel = FilterModel; if (!string.IsNullOrWhiteSpace(country)) { this.FilterModel.Cities = Common.GetCitiesByCountry(country); } if (!string.IsNullOrWhiteSpace(contributor)) { this.FilterModel.Contributors = Common.GetContributors(); } FilterModel.selectedCity = city; FilterModel.selectedContributor = contributor; FilterModel.selectedPractice = practice; FilterModel.selectedCountry = country; FilterModel.selectedAffiliate = affiliate; this.FoundArticles = ArticleCore.GetFilteredArticles(affiliate, practice, contributor, country, city, page); this.RelatedContributors = ContributorCore.GetContributorsById(FoundArticles.Select(x => x.ContributorID).ToList()); this.RelatedAffiliates = AffiliateCore.GetAffiliatesById(FoundArticles.Select(x => x.AffiliateID).ToList()); }
public ContributorsViewModel(List <Contributor> Contributors) { this.Contributors = Contributors; this.RelatedAffiliates = AffiliateCore.GetAffiliatesById(Contributors.Select(x => x.AffiliateID).ToList()); }