Ejemplo n.º 1
0
        public async Task <IActionResult> AppCacheManifest()
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("CACHE MANIFEST");
            sb.AppendLine("CACHE:");
            sb.AppendLine("/");
            sb.AppendLine("/Feed");
            sb.AppendLine("/favicon.ico");
            sb.AppendLine("/lib/bootstrap/dist/css/bootstrap.css");
            sb.AppendLine("/lib/jquery/dist/jquery.js");
            sb.AppendLine("/lib/bootstrap/dist/js/bootstrap.js");
            sb.AppendLine(_cache.Get("/css/site.css")?.ToString());
            sb.AppendLine(_cache.Get("/js/site.js")?.ToString());

            var articles = await _feedService.GetArticles();

            foreach (var article in articles)
            {
                sb.AppendLine("/Feed/ArticleContent?ArticleId=" + article.Id);
                foreach (var url in article.ResourcesUrl)
                {
                    sb.AppendLine(url);
                }
            }
            sb.AppendLine("# LastPublishedDate : " + articles.First().DatePublished.ToString());
            sb.AppendLine("NETWORK:");
            sb.AppendLine("*");

            return(Content(sb.ToString(), "text/cache-manifest"));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Index()
        {
            var items = await _feedService.GetArticles();

            return(View(items));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> GetArticles([FromQuery] int pageNumber, [FromQuery] ArticlesOptions articlesOptions)
        {
            var articles = await feedService.GetArticles(pageNumber == 0? 1 : pageNumber, appSettings.Value.PageSize, articlesOptions);

            return(Ok(articles));
        }