Advertisement
locnhse61312

Untitled

Nov 14th, 2014
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.75 KB | None | 0 0
  1.  //
  2.         //  GET: /LogIn/
  3.  
  4.         public ActionResult LogIn()
  5.         {
  6.             return View();
  7.         }
  8.  
  9.         //
  10.         // POST: /LogIn/
  11.  
  12.         [HttpPost]
  13.         public ActionResult LogIn(user user)
  14.         {
  15.             //Check valid user
  16.             //
  17.             bool isValid = false;
  18.             foreach (var item in db.users.ToList())
  19.             {
  20.                 if (item.usename == user.usename && item.password == user.password)
  21.                 {
  22.                     isValid = true;
  23.                 }
  24.             }
  25.  
  26.             if (isValid)
  27.             {
  28.                 Session["currentUser"] = user;
  29.                 return RedirectToAction("Index","Home");
  30.             }
  31.             return View(user);
  32.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement