コード例 #1
0
        //changepwd:GET
        public ActionResult changepasswd(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            MyIdentify Iden = new MyIdentify();

            Iden.id = (int)id;
            return(View(Iden));
        }
コード例 #2
0
        public ActionResult changepasswd([Bind(Include = "id,oldpwd,newpwd,newpwd2")] MyIdentify myIdentify)
        {
            if (ModelState.IsValid)
            {
                int      idx      = myIdentify.id;
                SYS_USER sYS_USER = db.SYS_USER.Find(idx);
                sYS_USER.pwd = myIdentify.newpwd2;

                db.Entry(sYS_USER).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index", new { id = idx }));
            }

            return(View(myIdentify));
        }