public ActionResult Register()
 {
     LoginAndRegisterModel model = new LoginAndRegisterModel();
     model.LoginIndexModel = new LoginIndexModel();
     model.RegisterIndexModel = new RegisterIndexModel();
     model.RegisterModel = new RegisterModel();
     return View(model);
 }
        public ActionResult Index(LoginAndRegisterModel model)
        {
            UserInfo user = this.IUserInfoDataProvider.FindUserInfoByUserNameAndPassword(model.LoginIndexModel.UserName, model.LoginIndexModel.Password);

            if (user != null)
            {
                FormsAuthentication.SetAuthCookie(user.ID.ToString(), true);
                return RedirectToAction("Index", "Home", null);
            }
            else
            {
                model.LoginIndexModel.IsFail = true;
                model.RegisterIndexModel = new RegisterIndexModel();
                model.RegisterModel = new RegisterModel();
                return View(model);
            }
        }
        public ActionResult Register(LoginAndRegisterModel model)
        {
            if (model.RegisterIndexModel.Email == null)
            {
                return RedirectToAction("Register", "LoginAndRegister", model);
            }

            UserInfo user = this.IUserInfoDataProvider.GetUserListByEmail(model.RegisterIndexModel.Email);

            if (user == null)
            {
                return RedirectToAction("RegisterUser", "LoginAndRegister", model.RegisterIndexModel);
            }
            else
            {
                model.RegisterIndexModel.IsExist = true;
                model.LoginIndexModel = new LoginIndexModel();
                model.RegisterModel = new RegisterModel();
                return View(model);
            }
        }
 public ActionResult TurnToRegister(LoginAndRegisterModel model)
 {
     return RedirectToAction("Register", "LoginAndRegister", model);
 }
 public ActionResult RegisterUser(LoginAndRegisterModel model)
 {
     RegisterModel userModel = model.RegisterModel;
     UserInfo useInfo = userModel.GetEntity();
     if (this.IUserInfoDataProvider.GetUserListByLoginName(userModel.LoginName).Count() > 0)
     {
         userModel.ErrorState = true;
         userModel.StateMessage = "LoginName is exsit";
         model.RegisterModel = userModel;
         model.LoginIndexModel = new LoginIndexModel();
         model.RegisterIndexModel = new RegisterIndexModel();
         return View(model);
     }
     else
     {
         this.IUserInfoDataProvider.Add(useInfo);
         FormsAuthentication.SignOut();
         return RedirectToAction("Index", "LoginAndRegister");
     }
 }
        public ActionResult RegisterUser(RegisterIndexModel indexModel)
        {
            RegisterModel userModel = new RegisterModel();
            userModel.InitRegisterModel(indexModel);

            LoginAndRegisterModel model = new LoginAndRegisterModel();
            model.LoginIndexModel = new LoginIndexModel();
            model.RegisterIndexModel = indexModel;
            model.RegisterModel = userModel;

            if (indexModel.Email == null)
            {
                return RedirectToAction("Register", "LoginAndRegister", model);
            }
            else
            {

                return View(model);
            }
        }