public IActionResult Profile(string profileName) { ModelsCombined.User user = DB.Users.Where(u => u.userName == profileName).FirstOrDefault(); IEnumerable <Post> userPosts = DB.Posts.Where(u => u.posterName == profileName); ViewData["User"] = DB.Users.Where(u => u.userName == profileName).FirstOrDefault(); ViewData["Posts"] = DB.Posts.Where(u => u.posterName == profileName); return(View(userPosts)); }
public IActionResult Login(ModelsCombined.User compare) { ModelsCombined.User user = DB.Users.Where(u => u.userName == compare.userName && u.password == compare.password).FirstOrDefault(); if (user != null) { HttpContext.Session.SetString("username", user.userName.ToString()); return(RedirectToAction("Index")); } else { return(RedirectToAction("Login")); } }