Ejemplo n.º 1
0
        public PostList List()
        {
            var posts = dbContext.Posts;

            var model = new PostList {
                Posts = new List <PostList.Post>()
            };

            foreach (var post in posts)
            {
                model.Posts.Add(new PostList.Post {
                    Id       = post.Id,
                    Link     = post.Link,
                    PostedBy = post.PostedBy,
                    Title    = post.Title
                });
            }
            return(model);
        }
Ejemplo n.º 2
0
        public IActionResult Index()
        {
            PostList posts = postService.List();

            return(View(posts));
        }