private MultiSelectList ListForPosts() { Post[] posts = _postProvider.GetPosts(); MultiSelectList multiSelectList = new MultiSelectList(posts, "PostId", "PostName"); return(multiSelectList); }
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")); }
public ActionResult PostsList() { return(View(_postProvider.GetPosts())); }
public IEnumerable <PostDto> GetPosts() { var post = postProvider.GetPosts(); return(mapper.Map <IEnumerable <PostDto> >(post)); }
public async Task <ActionResult <List <Post> > > GetPosts(PublishedStatus filter, PostType postType) { return(await _postProvider.GetPosts(filter, postType)); }