public ActionResult Register(string userName, string email, string password, string confirmPassword, int parentID)
            {
            var rm = new RegisterModel();
            rm.ConfirmPassword = confirmPassword;
            rm.Email = email;
            rm.Password = password;
            rm.UserName = userName;
            rm.PartnerCode = parentID;
            return Register1(rm);

            }
        public ActionResult Register(RegisterModel model)
        {
            if (ModelState.IsValid)
            {
                // Attempt to register the user
                MembershipCreateStatus createStatus;
                Membership.CreateUser(model.UserName, model.Password, model.Email, null, null, true, null, out createStatus);

                if (createStatus == MembershipCreateStatus.Success)
                {
                    FormsAuthentication.SetAuthCookie(model.UserName, false /* createPersistentCookie */);
                    return RedirectToAction("Index", "Home");
                }
                else
                {
                    ModelState.AddModelError("", ErrorCodeToString(createStatus));
                }
            }

            // If we got this far, something failed, redisplay form
            return View(model);
        }
            public ActionResult Register1(RegisterModel model)
            {
            ViewBag.Title = "Регистрация. Автоматическая торговля на рынке форекс. Скачать советник бессплатно.";
            ViewData["emailValidator"] = @"/^(([^<>()[\]\\.,;:\s@\""]+(\.[^<>()[\]\\.,;:\s@\""]+)*)|(\"".+\""))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/";
            if (ModelState.IsValid)
            {
                // Attempt to register the user
                MembershipCreateStatus createStatus;
                Membership.CreateUser(model.UserName, model.Password, model.Email, null, null, true, null, out createStatus);
                if (createStatus == MembershipCreateStatus.Success)
                {
                    long? pCode;
                    if (model.PartnerCode == 0)
                    {
                        pCode = null;
                    }
                    else
                    {
                        pCode = model.PartnerCode;
                    }
                    UsersManager.CreatePartnerRecord(model.UserName, pCode);
                    return Json(new { Success = true });
                }
                else
                {
                    ModelState.AddModelError("", ErrorCodeToString(createStatus));
                }
            }

            // If we got this far, something failed, redisplay form
            return View("Registration", model);

            }