Пример #1
0
        private MultiSelectList ListForPosts()
        {
            Post[]          posts           = _postProvider.GetPosts();
            MultiSelectList multiSelectList = new MultiSelectList(posts, "PostId", "PostName");

            return(multiSelectList);
        }
Пример #2
0
        public async Task <IActionResult> Sitemap()
        {
            var sitemapNamespace = XNamespace.Get("http://www.sitemaps.org/schemas/sitemap/0.9");

            var posts = await _postProvider.GetPosts(PublishedStatus.Published, PostType.Post);

            var doc = new XDocument(
                new XDeclaration("1.0", "utf-8", null),
                new XElement(sitemapNamespace + "urlset",
                             from post in posts
                             select new XElement(sitemapNamespace + "url",
                                                 new XElement(sitemapNamespace + "loc", GetPostUrl(post)),
                                                 new XElement(sitemapNamespace + "lastmod", GetPostDate(post)),
                                                 new XElement(sitemapNamespace + "changefreq", "monthly")
                                                 )
                             )
                );

            return(Content(doc.Declaration + Environment.NewLine + doc, "text/xml"));
        }
Пример #3
0
 public ActionResult PostsList()
 {
     return(View(_postProvider.GetPosts()));
 }
Пример #4
0
        public IEnumerable <PostDto> GetPosts()
        {
            var post = postProvider.GetPosts();

            return(mapper.Map <IEnumerable <PostDto> >(post));
        }
Пример #5
0
 public async Task <ActionResult <List <Post> > > GetPosts(PublishedStatus filter, PostType postType)
 {
     return(await _postProvider.GetPosts(filter, postType));
 }