public ActionResult Register(RegisterUser model)
        {
            {
                // Attempt to register the user
                try
                {
                    //WebSecurity.CreateUserAndAccount(model.UserName, model.Password);
                    bool registerStatus = UserDAL.RegisterUser(model.UserName,model.Password,model.FirstName,model.Address,model.Email,
                        model.SecurityQuestion,model.SecurityAnswer,model.SelectMembershipType);
                    var userId =  UserDAL.AuthenticateUser(model.UserName, model.Password).UserID;
                  //  bool addBankDetails = UserDAL.AddBankDetails(userId, model.BankName, model.AccountNo, model.TransactionPassword );
                  //  bool AddMembershipTransaction = UserDAL.AddMembershipTransaction(userId, model.BankName, model.AccountNo,  model.TransactionPassword);
                    if (registerStatus)
                    {
                        Login(new UserLogin { UserName = model.UserName, Password = model.Password }, "");
                        return RedirectToAction("Index", "Home");
                    }//UserDAL.AuthenticateUser(model.UserName, model.Password);

                }
                catch (MembershipCreateUserException e)
                {
                    ModelState.AddModelError("", ErrorCodeToString(e.StatusCode));
                }
                catch (Exception)
                {
                    ModelState.AddModelError("", "some Error occured");
                }
            }
            // If we got this far, something failed, redisplay form
            var list = new List<string>();
            //list.Add(new SelectListItem(){ Value="1", Text="What was the make and model of your first car?"});
            //list.Add(new SelectListItem(){ Value="2", Text="What was the last name of your third grade teacher?"});
            //list.Add(new SelectListItem(){ Value="3", Text="Enter your favourate number"});
            //list.Add(new SelectListItem(){ Value="4", Text="What was your favorite sport in high school?"});
            list.Add("What was the make and model of your first car?");
            list.Add("What was the last name of your third grade teacher?");
            list.Add("Enter your favourate number");
            list.Add("What was your favorite sport in high school?");
            ViewBag.SecurityQuestionList = list;
            List<string> banks = new List<string>();
            banks.Add("HDFC");
            banks.Add("CITI");
            banks.Add("ICICI");
            banks.Add("SBI");
            ViewBag.listbank = banks;
            return View(model);
        }
Exemplo n.º 2
0
        public ActionResult Register(RegisterUser model)
        {
            if (ModelState.IsValid)
            {
                // Attempt to register the user
                try
                {
                    WebSecurity.CreateUserAndAccount(model.UserName, model.Password);
                    WebSecurity.Login(model.UserName, model.Password);
                    return RedirectToAction("Index", "Home");
                }
                catch (MembershipCreateUserException e)
                {
                    ModelState.AddModelError("", ErrorCodeToString(e.StatusCode));
                }
            }

            // If we got this far, something failed, redisplay form
            return View(model);
        }
Exemplo n.º 3
0
        public ActionResult Register(RegisterUser model)
        {
            {
                // Attempt to register the user
                try
                {
                    //WebSecurity.CreateUserAndAccount(model.UserName, model.Password);
                    bool registerStatus = UserDAL.RegisterUser(model.UserName,model.Password,model.FirstName,model.Address,model.Email,
                        model.SecurityQuestion,model.SecurityAnswer,model.SelectMembershipType);
                    if (registerStatus)
                    {
                        Login(new UserLogin { UserName = model.UserName, Password = model.Password }, "");
                        return RedirectToAction("Index", "Home");
                    }//UserDAL.AuthenticateUser(model.UserName, model.Password);

                }
                catch (MembershipCreateUserException e)
                {
                    ModelState.AddModelError("", ErrorCodeToString(e.StatusCode));
                }
                catch (Exception)
                {
                    ModelState.AddModelError("", "some Error occured");
                }
            }
            // If we got this far, something failed, redisplay form
            return View(model);
        }