private PostsListVM CreatePostsListVM() { if (postsListVM == null) { postsListVM = new PostsListVM(messenger, dbUser, dbOrganization, dbGroup, dbPost, dbComment); } return(postsListVM); }
public IActionResult Index(string catname) { PostsListVM x = new PostsListVM { Items = ctx.Posts.Where(p => p.Category.Name == catname) .Select(p => new PostsListVM.ItemInfo { Title = p.Title, PostId = p.PostID, Body = p.Body }) .ToList() }; return(View(x)); }