public IActionResult Index(string username) { if (string.IsNullOrEmpty(username)) { return(View("LoginPage")); } //var postlist = postServer.FindAll().ToList(); var user = userServer.FindByName(username); var postlist = postServer.FindAll(user.UserId).ToList(); //if (user is null) //{ // return View("LogonPage"); //} var viewModel = new UserPostsViewModel() { PostList = postlist, User = user }; return(View(viewModel)); }