Пример #1
0
 public ActionResult Index(User user)
 {
     using (var userContext = new UserContext())
     {
         userContext.Users.Add(user);
         userContext.SaveChanges();
         ViewBag.user = user;
         return View("Result");
     }
 }
Пример #2
0
        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");
        }
Пример #3
0
 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");
 }