Example #1
0
        public PagedList <Services.ViewModels.ArticleViewModel> getRelatedArticles(Services.ViewModels.ArticleViewModel art, int limit = 10, bool matchAllCategories = false, bool matchAllTags = false)
        {
            List <ArticleStatus> lStatus = new List <ArticleStatus>();

            lStatus.Add(ArticleStatus.Live);
            var related = ArticleRepo.Instance.GetPagedList(this.ModuleId, 0, limit + 1, "", lStatus, true, -1,
                                                            art.Categories.Select(c => c.CategoryID).ToList(), art.Tags.Select(t => t.TagID).ToList(),
                                                            DateTime.Now, "Rank", true, matchAllCategories, matchAllTags);

            related.Remove(related.Where(a => a.ArticleID == art.ArticleID).FirstOrDefault());
            var ret = Mapper.Map <PagedList <Components.Entities.Article>, PagedList <Services.ViewModels.ArticleViewModel> >(related);

            ret.ForEach(a => {
                setVwUrl(ref a);
            });
            return(ret);
        }
Example #2
0
 private void setVwUrl(ref Services.ViewModels.ArticleViewModel avm)
 {
     avm.vwURL = UrlHelper.GetArticleURL(this.TabId, avm.ArticleID);
 }