public ActionResult LogIn(LogInModel logInModel) { if (ModelState.IsValid) { var user = _userBl.GetUserByLoginAndPassword(logInModel.Login, logInModel.Password); if (user.UserName != null) { //Session["UserFullName"] = user.UserName + " " + user.LastName; //Session["UserLogin"] = user.Login; FormsAuthentication.SetAuthCookie(user.Login, false); return(RedirectToAction("Index", "Home")); } else { ModelState.AddModelError("", "Provided login or password is incorect"); return(View(logInModel)); } } return(View(logInModel)); }