private IEnumerable <ArticleItemViewModel> GetArticles() { if (this.ReferenceDate != null) { return(ArticleModel.GetAuthorArticlesByMonth(this.Author.Slug, this.ReferenceDate.Reference) .Select(a => new ArticleItemViewModel(a))); } return(ArticleModel.GetRecentArticlesByAuthor(this.Author.Slug) .Select(a => new ArticleItemViewModel(a))); }
public ActionResult ViewRecentArticlesByAuthorAndCount(string slug, int count = 8) { if (count > 100) { return(ErrorStatus(HttpStatusCode.BadRequest, "Count cannot be greater than 100")); } var articles = ArticleModel.GetRecentArticlesByAuthor(slug, count); if (IsEmpty(articles)) { return(ErrorStatus(HttpStatusCode.NotFound, "Invalid Author")); } return(FormatOutput(articles)); }
public string ViewRecentArticlesByAuthorAndCount(string slug, int count = 8) { if (count > 100) { return(ErrorStatus("Count cannot be greater than 100")); } var articles = ArticleModel.GetRecentArticlesByAuthor(slug, count); if (IsEmpty(articles)) { return(ErrorStatus("Invalid Author")); } return(FormatOutput(articles)); }
public MyArticlesViewModel(string authorSlug) { this.UnpublishedArticles = ArticleModel.GetUnpublishedArticles(authorSlug); this.RecentPublishedArticles = ArticleModel.GetRecentArticlesByAuthor(authorSlug, this.MaxPublishedArticleCount); }