public ActionResult Index(User user) { using (var userContext = new UserContext()) { userContext.Users.Add(user); userContext.SaveChanges(); ViewBag.user = user; return View("Result"); } }
public ActionResult FindSafeUser(User user) { using (var userContext = new UserContext()) { List<User> users = userContext.Users.Where(u => u.Login == user.Login && u.Password == user.Password) .ToList(); ViewBag.users = users; } return View("ResultUsers"); }
public ActionResult FindUser(User user) { using (var userContext = new UserContext()) { List<User> users = userContext.Users.SqlQuery( "SELECT * FROM dbo.Users " + "WHERE (dbo.Users.Login LIKE '" + user.Login + "') and (dbo.Users.Password LIKE '" + user.Password + "');" ) .ToList(); ViewBag.users = users; } return View("ResultUsers"); }