public async Task<IActionResult> EditInfo(EditInfoViewModel model)
        {
            if (ModelState.IsValid)
            {
                var userInfo = (await _service.GetCurrentUserAsync()).UserInfo;
                if (model.CardID != userInfo.CardID)
                {
                    if (await _dbContext.UserInfos.AnyAsync(u =>
                        u.CardID.Equals(model.CardID, StringComparison.OrdinalIgnoreCase)))
                    {
                        ModelState.AddModelError("CardId", "您输入的身份证号码已存在!");
                        return View(model);
                    }
                }

                bool? sex = null;
                if (model.Sex == 1)
                {
                    sex = true;
                }
                else if (model.Sex == 2)
                {
                    sex = false;
                }
                userInfo.Name = model.Name;
                userInfo.Sex = sex;
                userInfo.CardID = model.CardID;
                userInfo.Birthday = model.Birthday;
                await _service.UpdateInfoAsync(userInfo);
                return RedirectToAction(nameof(AccountController.Index), new { id = "UserInfoView" });
            }

            return View(model);
        }
 public async Task<IActionResult> EditInfo()
 {
     var userInfo = (await _service.GetCurrentUserAsync()).UserInfo;
     var model = new EditInfoViewModel
     {
         Name = userInfo.Name,
         Sex = userInfo.Sex.HasValue ? (userInfo.Sex.Value ? 1 : 2) : 0,
         Birthday = userInfo.Birthday,
         CardID = userInfo.CardID
     };
     return View(model);
 }