コード例 #1
0
        public ActionResult ChangePassword(updatepassword input)
        {
            bool status  = false;
            var  message = "Password changed failed";

            ModelState.Remove("productname");
            ModelState.Remove("productid");
            ModelState.Remove("businessname");
            ModelState.Remove("clientname");
            ModelState.Remove("clientemail");
            ModelState.Remove("contactmobile");
            ModelState.Remove("clientaddress");
            ModelState.Remove("expirydate");

            if (ModelState.IsValid)
            {
                if (input.recordid > 0)
                {
                    var olddata = _mainobj.GetById(input.recordid);
                    olddata.upassword = StaticData.GetSHA512(input.newpassword);
                    var result = _mainobj.Update(input.recordid, olddata);
                }

                status = true;

                message = "Password Succesfully changed";
            }
            return(new JsonResult {
                Data = new { status = status, message = message }
            });
        }
コード例 #2
0
        public ActionResult ChangePassword(int id)
        {
            if (id <= 0)
            {
                return(HttpNotFound());
            }
            var result = _mainobj.GetById(id);

            if (result != null)
            {
                var newpasswordmodel = new updatepassword()
                {
                    clientname  = result.clientname,
                    clientemail = result.clientemail,
                    recordid    = result.recordid,
                };
                return(PartialView("_ChangePassword", newpasswordmodel));
            }
            else
            {
                return(HttpNotFound());
            }
        }