// GET: Posts public async Task <IActionResult> Index() { List <Post> posts = pm.GetPosts(); foreach (Post p in posts) { User u = um.GetUser_Detail(p.owner._id); p.owner.user_name = u.first_name + " " + u.last_name; p.owner.user_picture = u.profile_img; } return(View(posts)); }