public ActionResult CheckLogin(UserDetailDTO userdetailDTO) { ModelState.Where(m => m.Key == "UserName").FirstOrDefault().Value.Errors.Clear(); ModelState.Where(m => m.Key == "CompanyName").FirstOrDefault().Value.Errors.Clear(); // ModelState.Where(m => m.Key == "OTP").FirstOrDefault().Value.Errors.Clear(); ModelState.Where(m => m.Key == "MobileNo").FirstOrDefault().Value.Errors.Clear(); if (ModelState.IsValid) { UserDetail userDetail = new UserDetail(); userDetail = Mapper.Map<ViewModel.UserDetailDTO, UserDetail>(userdetailDTO); List<UserDetail> userDTL = _LoginService.checkLogin(userDetail); if (userDTL.Count > 0) { Session["UserName"] = userDTL[0].UserName; Session["UserId"] = userDTL[0].Id; Session["UserRole"] = userDTL[0].RoleId; Session["UserEmailId"] = userDTL[0].EmailId; return RedirectToAction("Index", "DashBoard"); // return RedirectToAction("NewLoanEntry", "Dashboard"); } return View("Login", userdetailDTO); } else { return View("Login", userdetailDTO); } }
// GET: Login public ActionResult Login() { UserDetailDTO userdetailDTO = new UserDetailDTO(); return View("Login", userdetailDTO); }
public LoginController() { userDetailDTO = new UserDetailDTO(); _LoginService = new LoginService(); }