Example #1
0
        public ActionResult ChangePassword(ChangePasswordModel obj)
        {
            string   uid = Convert.ToString(Session["userName"]);
            SVR_USER u   = db.SVR_USER.Find(uid);

            if (u.PASSWORD == obj.OldPassword)
            {
                if (obj.NewPassword == obj.ConfirmNewPassword)
                {
                    u.PASSWORD        = obj.NewPassword;
                    db.Entry(u).State = EntityState.Modified;
                    db.SaveChanges();
                    TempData["Message"] = "Your Password is Update Successfully!";
                }
                else
                {
                    TempData["Message"] = "Your Password is Incorrect!";
                }
            }
            else
            {
                TempData["Message"] = "Invalid Current password!";
            }
            return(RedirectToAction("Index", "SVR_VIEW", TempData["Message"]));
        }
Example #2
0
 public ActionResult Authorise(SVR_USER user)
 {
     using (anhthaiEntities db = new anhthaiEntities())
     {
         var userDetail = db.SVR_USER.Where(x => x.USERNAME == user.USERNAME && x.PASSWORD == user.PASSWORD).FirstOrDefault();
         if (userDetail == null)
         {
             user.LoginErrorMsg = "Invalid UserName or Password";
             return(View("Index", user));
         }
         else
         {
             Session["userName"] = user.USERNAME;
             return(RedirectToAction("Index", "SVR_VIEW"));
         }
     }
 }