public ActionResult Register(UserInfo user)
        {
            if (CheckValidateCode())
            {
                IUserInfoService userInfoService = new UserInfoService();
                user.RoleID = 2;
                user.RegisterTime = DateTime.Now;
                user.NiCheng = user.LoginID;
                user.State = false;
                Random r = new Random();
                user.ActiCode = r.Next(100000, 1000000);
                UserInfo u = userInfoService.AddEntity(user);
                if (u != null)
                {
                    //注册成功 进行邮件验证  验证成功后才可登录
                    //使用LoginId跟Acticode进行验证

                    //return RedirectToAction("Index","Home");
                    //Response.Redirect()
                    //return View();
                    return Redirect("/Account/Verify");
                }
                else
                {
                    return Content("0");
                }
            }
            else
            {
                return Content("验证码错误");
            }
        }
        public ActionResult Register(UserInfo user)
        {
            //验证邮箱是否注册
            if (!IsExistByEmail(user.Email))
            {//邮箱不存在可以注册
             //填写默认信息  插入数据库

                //发送激活邮件

                //跳转到Register视图

                return View();
            }
            else
            {//邮箱已存在
                //返回注册View ,找回密码,或输入其他邮箱
                //ViewData["result"] = "邮箱以存在";
                ViewBag.Message = "1";
                return Redirect("Index");
            }
        }
        public  ActionResult Register(UserInfo model)
        {
            //if (ModelState.IsValid)
            //{
                //var user = new ApplicationUser { UserName = model.Email, Email = model.Email };
                model.RoleID = 2;//普通用户
                model.State = false;//刚注册还没有激活呢
                model.NiCheng = model.Email;
                model.LoginID = model.Email;
                //var result = await UserManager.CreateAsync(user, model.UserPwd);
                //if (result.Succeeded)
                //{ 
                //    await SignInManager.SignInAsync(model, 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("Verify", "Account");
                //}
                //AddErrors(result);
            //}

            // 如果我们进行到这一步时某个地方出错,则重新显示表单
            //return View(model);
        }