public string ViewRecentArticlesBySeriesAndCount(string slug, int count = 8) { if (count > 100) { return(ErrorStatus("Count cannot be greater than 100")); } var articles = ArticleModel.GetRecentArticlesBySeries(slug, count); if (IsEmpty(articles)) { return(ErrorStatus("Invalid Series")); } return(FormatOutput(articles)); }
public ActionResult ViewRecentArticlesBySeriesAndCount(string slug, int count = 8) { if (count > 100) { return(ErrorStatus(HttpStatusCode.BadRequest, "Count cannot be greater than 100")); } var articles = ArticleModel.GetRecentArticlesBySeries(slug, count); if (IsEmpty(articles)) { return(ErrorStatus(HttpStatusCode.NotFound, SeriesModel.GetSeriesBySlug(slug) == null ? "Invalid Series" : "No articles found")); } return(FormatOutput(articles)); }
public ArticlesIndexViewModel(SeriesModel series, DateTime?reference = null) { this.Series = series; this.ReferenceDate = new DateInfo(reference ?? ArticleModel.GetRecentArticlesBySeries(series.Slug, 1).FirstOrDefault()?.PublishedDate ?? DateTime.Now); }