public IActionResult ModifPhoneNumber() { ModifPhoneNumberVM model = new ModifPhoneNumberVM(); ViewBag.headerUrl = HttpContext.Session.GetString("headimgurl"); return(View(model)); }
public IActionResult ModifPhoneNumber(ModifPhoneNumberVM model) { if (ModelState.IsValid) { var PhoneValidateCode = HttpContext.Session.GetString(model.PhoneNumber); var openId = HttpContext.Session.GetString("OpenId"); var member = _context.Menbers.FirstOrDefault(x => x.WeChatOpenId == openId); if (model.PhoneValidateCode == PhoneValidateCode) { member.PhoneNumber = model.PhoneNumber; RCLog.Info(this, $"新手机号码为{ model.PhoneNumber}"); _context.Update(member); _context.SaveChanges(); return(RedirectToAction("Me", "WeChat")); } } ViewBag.headerUrl = HttpContext.Session.GetString("headimgurl"); return(View(model)); }