Example #1
0
        public ActionResult Registration(RegistrationModel registrationView)
        {
            bool   statusRegistration    = false;
            string messageRegistration   = string.Empty;
            OrganisationFactory oFactory = new OrganisationFactory();

            if (ModelState.IsValid)
            {
                // Email Verification
                string userName = Membership.GetUserNameByEmail(registrationView.Email);
                if (!string.IsNullOrEmpty(userName))
                {
                    ModelState.AddModelError("Warning Email", "Sorry: Email already Exists");
                    RegistrationModel regmodel = oFactory.PrepareRegistrationModel();
                    registrationView.OrganisationTypes = regmodel.OrganisationTypes;
                    return(View(registrationView));
                }

                //Save User Data

                registrationView.ActivationCode = Guid.NewGuid();
                oFactory.RegisterUser(registrationView);


                //Verification Email
                VerificationEmail(registrationView.Email, registrationView.ActivationCode.ToString());
                messageRegistration = "Your account has been created successfully. ^_^";
                statusRegistration  = true;
            }
            else
            {
                messageRegistration = "Something Wrong!";
            }
            ViewBag.Message = messageRegistration;
            ViewBag.Status  = statusRegistration;

            return(View(registrationView));
        }
Example #2
0
        public ActionResult Registration()
        {
            OrganisationFactory oFactory = new OrganisationFactory();

            return(View(oFactory.PrepareRegistrationModel()));
        }