Example #1
0
        public ActionResult ChangePassword()
        {
            //Pass PhotoGrapher ID to The View Page
            PhotoGrapherChangePassword ch = new PhotoGrapherChangePassword();

            ch.PhotoGrapherId = PhotoGrapherID;
            return(View(ch));
        }
Example #2
0
        //PhotoGrapher Change Password
        public bool ChangePassword(PhotoGrapherChangePassword Pass_Change)
        {
            //Find The Client Object
            var obj = Db.Set <PhotoGrapher>().Where(a => a.PhotoGrapherId == Pass_Change.PhotoGrapherId).FirstOrDefault();

            if (obj.Password == Pass_Change.CurrentPassword)
            {
                //new Password set
                obj.Password = Pass_Change.NewPassword;

                //Single Field Update
                Db.Configuration.ValidateOnSaveEnabled = false;

                Db.SaveChanges();
                return(true);
            }

            else
            {
                return(false);
            }
        }
Example #3
0
        public ActionResult ChangePassword(PhotoGrapherChangePassword chng)
        {
            if (ModelState.IsValid)
            {
                // up.ConfirmPassword = up.Password;

                var pass = ph.ChangePassword(chng);

                if (pass == true)
                {
                    TempData["msg"] = "<script>alert('Change Password Sccessfully');</script>";

                    return(RedirectToAction("Profile"));
                }

                else
                {
                    ModelState.AddModelError("Wrong", "Current Password Incorrect");
                }
            }

            return(View(chng));
        }