Beispiel #1
0
 public ActionResult customerRegistration(LoginModel objmodel)
 {
     if (ModelState.IsValid)
     {
         return View("Completed");
     }
     var result = _accountmanager.CustomerRegistration(objmodel);
     return View();
 }
Beispiel #2
0
 public tblUser AuthenticateUser(LoginModel objLoginModel)
 {
     tblUser objLogin = null;
     using (ticketmanagmentEntities dbobj = new ticketmanagmentEntities())
     {
        objLogin= dbobj.tblUsers.Where(x =>
             x.userName == objLoginModel.UserName &&
             x.Password == objLoginModel.Password &&
             x.RoleId == objLoginModel.UserRole && x.IsActive == true
             ).FirstOrDefault();
     }
     return objLogin;
 }
Beispiel #3
0
 public bool CustomerRegistration(LoginModel objLoginModel)
 {
     tblUser objUser = (objLoginModel.LoginId == 0) ? new tblUser() : dbobj.tblUsers.Where(x => x.userId == objLoginModel.LoginId).FirstOrDefault();
     objUser.userName = objLoginModel.UserName;
     objUser.Password = objLoginModel.Password;
     objUser.CreatedDate = DateTime.Now;
     objUser.FirstName = objLoginModel.FirstName;
     objUser.LastName = objLoginModel.LastName;
     objUser.IsActive = true;
     objUser.RoleId = 3;
     if (objLoginModel.LoginId == 0)
     {
         dbobj.tblUsers.Add(objUser);
     }
     dbobj.SaveChanges();
     return true;
 }
Beispiel #4
0
 public ActionResult Login(LoginModel objLoginModel)
 {
     var result=_accountmanager.AuthenticateUser(objLoginModel);
         if (result != null)
         {
             FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(
                       1,
                       result.userId.ToString(CultureInfo.CurrentCulture),                          //user Name
                       DateTime.Now,
                       DateTime.Now.AddMinutes(30),                          // expiry in 30 min
                       objLoginModel.RememberMe,
                      objLoginModel.UserRole.ToString(CultureInfo.CurrentCulture) + "_" + result.userId.ToString());
             HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName,
                                                FormsAuthentication.Encrypt(authTicket));
             Response.Cookies.Add(cookie);
             return RedirectToAction("DashBoard", "Home");
         }
     else
     {
         ModelState.AddModelError("", "Invalid User");
     }
     return View("Index", objLoginModel);
 }
Beispiel #5
0
 public bool CustomerRegistration(LoginModel objmodel)
 {
     return objAccountRepository.CustomerRegistration(objmodel);
 }
Beispiel #6
0
 public tblUser AuthenticateUser(LoginModel objLoginModel)
 {
     return objAccountRepository.AuthenticateUser(objLoginModel);
 }