Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public ActionResult Login()
- {
- if (Session["KlientId"] != null)
- return RedirectToAction("LoggedIn", "Klient");
- return View();
- }
- [HttpPost]
- public ActionResult Login(Klient klient)
- {
- var user = db.Klienci.FirstOrDefault(k => k.Login == klient.Login && k.Password == klient.Password);
- if (user != null)
- {
- TempData["KlientId"] = user.KlientId;
- Session["KlientId"] = user.KlientId;
- Session["Login"] = user.Login;
- Session.Timeout = 20;
- return Redirect("LoggedIn");
- }
- else
- {
- ModelState.AddModelError("", "Login lub hasło jest nieprawidłowe.");
- }
- return View();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement