Guest User

Untitled

a guest
Aug 27th, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. public ActionResult Index(Login userLogin)
  2. {
  3.  
  4. if (ModelState.IsValid)
  5. {
  6. Login Login = loginBusinessLayer.GetUserLogin(userLogin.UserId, userLogin.UserName);
  7. if (Login.UserPassword == userLogin.UserPassword)
  8. {
  9. Session["UserLogin"] = Login;
  10.  
  11. User user = userBusinessLayer.GetUser(Login.UserId);
  12. Role role = roleBusinessLayer.Roles.Single(rle => rle.RoleId == user.RoleId);
  13. Session["Role"] = role;
  14.  
  15. HttpCookie cookie = new HttpCookie("UserLogin");
  16. cookie["LoginId"] = Convert.ToString(Login.UserId);
  17. cookie["RoleId"] = Convert.ToString(role.RoleId);
  18. Response.Cookies.Add(cookie);
  19. return RedirectToAction("Success", "Login");
  20. }
  21. else
  22. {
  23. return View();
  24. }
  25. }
  26. return View();
  27. }
Add Comment
Please, Sign In to add comment