public ActionResult ToUpdateMemberData(int num, string password = "", string new_password = "", string tel = "", string name = "", string Email = "") { Dictionary<string, object> dic = new Dictionary<string, object>(); Member m = new Member(); MemberData md = new MemberData(); var datacount = md.Get().ToList().Where(a => a.num == num).Count(); var data = md.Get().ToList().Where(a => a.num == num).FirstOrDefault(); if (datacount > 0) { if (password != "") { if (data.uPassWord != PassWordSecurity.Sha384Encode(PassWordSecurity.Sha256Encode(password))) { TempData["msg"] = "舊密碼錯誤"; } else { m.num = num; m.uPassWord = PassWordSecurity.Sha384Encode(PassWordSecurity.Sha256Encode(new_password)); m.uphone = tel; m.uName = name; m.uemail = Email; m.udate = DateTime.Now; md.Update(m); TempData["msg"] = "更新成功"; } } else { m.num = num; m.uPassWord = data.uPassWord; m.uphone = tel; m.uName = name; if (Email != "") { m.uemail = Email; } else { m.uemail = data.uemail; } m.udate = DateTime.Now; md.Update(m); TempData["msg"] = "更新成功"; } } else { TempData["msg"] = "不正常管道錯誤"; } return RedirectToAction("Index", "Member"); }