コード例 #1
0
ファイル: MemberService.cs プロジェクト: 405410049/JiaDungDao
        public string EditMemberInformation(UpdateMemberInfo memberAfterEdit)
        {
            var originMember = MemberRepo.GetMemberByAcc(memberAfterEdit.m_account);

            if (originMember != null)
            {
                var result = MemberRepo.EditMemberInformation(originMember, memberAfterEdit);
                return(result);
            }
            return("查無此會員");
        }
コード例 #2
0
        public bool ResetPassword(UpdateMemberInfo memberInfo)
        {
            var member = MemberRepo.GetMemberByAcc(memberInfo.m_account);

            if (member != null)
            {
                var hash_new_password = HashPassword(memberInfo.new_password);
                return(MemberRepo.UpdatePassword(member, hash_new_password));;
            }
            return(false);
        }
コード例 #3
0
        public IActionResult EditMemberInformation(UpdateMemberInfo memberAfterEdit)
        {
            var result = MemberService.EditMemberInformation(memberAfterEdit);

            if (result == "Update completed!" || result == "查無此會員")
            {
                return(Ok(result));
            }
            else
            {
                return(BadRequest(result));
            }
        }
コード例 #4
0
        public IActionResult ResetPassword(UpdateMemberInfo memberInfo)
        {
            var result = MemberService.ResetPassword(memberInfo);

            if (result == true)
            {
                return(Ok("重設密碼成功"));
            }
            else
            {
                return(BadRequest("重設密碼失敗"));
            }
        }
コード例 #5
0
ファイル: MemberRepo.cs プロジェクト: whattiffany/JiaDungDao
        public string EditMemberInformation(Member originMember, UpdateMemberInfo memberAfterEdit)
        {
            string result = string.Empty;

            try {
                originMember.m_name     = memberAfterEdit.m_name;
                originMember.m_address  = memberAfterEdit.m_address;
                originMember.m_birthday = memberAfterEdit.m_birthday;
                originMember.m_email    = memberAfterEdit.m_email;
                db.SaveChanges();
                result = "Update completed!";
            } catch (Exception e) {
                result = e.Message.ToString();
            }
            return(result);
        }
コード例 #6
0
        public IActionResult SendResetPasswordMail(UpdateMemberInfo resetInfo)
        {
            var member = MemberService.GetMemberByAcc(resetInfo.m_account);

            if (member != null)
            {
                bool result = MailService.SendResetPasswordMail(resetInfo.m_email, member.m_account);
                if (result == true)
                {
                    return(Ok("寄送重設密碼連結信成功"));
                }
                return(BadRequest("寄送重設密碼連結信失敗"));
            }
            else
            {
                return(BadRequest("帳號不存在"));
            }
        }