コード例 #1
0
        public ActionResult passwordSet(Member mem, string newMemberPassword, string newMemberPassword2)
        {
            Member mem2 = db.Members.Find(mem.memberId);

            MyToolBox.CopyPropertiesTo(mem, mem2);

            if (mem2.memberPassword == newMemberPassword)
            {
                Session["passwdNotRepeat"] = "新密碼與原密碼相同";
                return(View(mem));
            }
            if (newMemberPassword2 != newMemberPassword)
            {
                Session["passwdNotRepeat"] = "新密碼重複錯誤";
                return(View(mem));
            }
            mem2.memberPassword = newMemberPassword;
            db.SaveChanges();
            return(RedirectToAction("Member"));
        }
コード例 #2
0
        public ActionResult editMemberProfile(Member mem)
        {
            Member mem2 = db.Members.Find(mem.memberId);

            MyToolBox.CopyPropertiesTo(mem, mem2);
            foreach (var mem3 in db.Members)
            {
                if (mem2.memberId != mem3.memberId)
                {
                    if (mem2.nickName == mem3.nickName)
                    {
                        Session["nickNameRepeat"] = "您的暱稱已經有人使用";
                        return(View(mem));
                    }
                }
            }
            db.SaveChanges();
            Session["userName"] = mem.nickName;
            return(RedirectToAction("Member"));
        }