Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // GET: /LogIn/
- public ActionResult LogIn()
- {
- return View();
- }
- //
- // POST: /LogIn/
- [HttpPost]
- public ActionResult LogIn(user user)
- {
- //Check valid user
- //
- bool isValid = false;
- foreach (var item in db.users.ToList())
- {
- if (item.usename == user.usename && item.password == user.password)
- {
- isValid = true;
- }
- }
- if (isValid)
- {
- Session["currentUser"] = user;
- return RedirectToAction("Index","Home");
- }
- return View(user);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement