예제 #1
0
        public async Task <Post[]> GetRecentPostsAsync(string blogid, string username, string password, int numberOfPosts)
        {
            await EnsureUser(username, password);

            var result = (await _repo.GetStories(numberOfPosts)).Stories.Select(s =>
            {
                var summary = new HtmlDocument();
                summary.LoadHtml(s.GetSummary());

                return(new Post()
                {
                    title = s.Title,
                    mt_excerpt = summary.DocumentNode.InnerText,
                    description = s.Title,
                    categories = s.Categories.Split(','),
                    dateCreated = s.DatePublished,
                    postid = s.Id,
                    permalink = string.Concat("https://saschamanns.de/", s.GetStoryUrl()),
                    link = string.Concat("https://saschamanns.de/", s.GetStoryUrl()),
                    wp_slug = s.Slug,
                    userid = "saschamanns",
                    wp_post_thumbnail = s.FeatureImageUrl
                });
            }).ToArray();

            return(result);
        }
예제 #2
0
 public async Task <IActionResult> Pager(int page = 1)
 {
     return(View("~/Views/Root/Index.cshtml", await _repo.GetStories(_pageSize, page)));
 }