Example #1
0
        public IActionResult ModifPhoneNumber()
        {
            ModifPhoneNumberVM model = new ModifPhoneNumberVM();

            ViewBag.headerUrl = HttpContext.Session.GetString("headimgurl");

            return(View(model));
        }
Example #2
0
        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));
        }