public async Task<ActionResult> Register(RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = new ApplicationUser { UserName = model.Email, Email = model.Email };
                var result = await UserManager.CreateAsync(user, model.Password);
                if (result.Succeeded)
                {
                    await SignInManager.SignInAsync(user, isPersistent:false, rememberBrowser:false);
                    
                    // 有关如何启用帐户确认和密码重置的详细信息,请访问 http://go.microsoft.com/fwlink/?LinkID=320771
                    // 发送包含此链接的电子邮件
                    // string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id);
                    // var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);
                    // await UserManager.SendEmailAsync(user.Id, "确认你的帐户", "请通过单击 <a href=\"" + callbackUrl + "\">這裏</a>来确认你的帐户");

                    return RedirectToAction("Index", "Home");
                }
                AddErrors(result);
            }

            // 如果我们进行到这一步时某个地方出错,则重新显示表单
            return View(model);
        }
        public async Task<ActionResult> Register(RegisterViewModel model)
        {
            //ViewBag.Register = "欢迎注册";
            if (ModelState.IsValid)
            {
                if (TempData["VerificationCode"] == null || TempData["VerificationCode"].ToString() != model.VerificationCode.ToUpper())
                {
                    ModelState.AddModelError("VerificationCode", "验证码不正确");
                    return View(model);
                }

                var tuser = await MemberBLL.Instance.Find_SysUser(model.Email);
                if (tuser != null && tuser.user_name == model.Email)
                    ModelState.AddModelError("UserName", "用户名已存在");

                var user = new Famliy.Finance.Models.sys_user
                {
                    user_name = model.Email,
                    email = model.Email,
                    password = Utils.MD5Encrypt(model.Password),
                    nick_name = model.NickName,
                    sex = model.Sex,
                    birthday = model.Birthday
                    //,sys_user_roles = new List<sys_user_role>(),
                    //bank_family = new bank_family()
            };                

                var item = await MemberBLL.Instance.Add_SysUser(user);
                if (item != null)
                {
                    sys_log logInfo = new sys_log();
                    logInfo.user_id = user.user_id;
                    logInfo.user_name = user.user_name;
                    logInfo.interface_name = "Register";
                    logInfo.interface_param = JsonHelper.ToJson(model);
                    logInfo.result = "OK";
                    LogBusiness.Instance.WriteLog(logInfo, GW.Utils.LogMsgLevel.Info);

                    return RedirectToAction("Index", "Home");
                }
                else
                {
                    sys_log logInfo = new sys_log();
                    logInfo.user_id = user.user_id;
                    logInfo.user_name = user.user_name;
                    logInfo.interface_name = "Register";
                    logInfo.interface_param = JsonHelper.ToJson(model);
                    logInfo.result = "Error";
                    LogBusiness.Instance.WriteLog(logInfo, GW.Utils.LogMsgLevel.Info);


                    AddErrors(new IdentityResult(new string[] { "注册失败" }));
                }
            }
            // 如果我们进行到这一步时某个地方出错,则重新显示表单
            return View(model);
        }