Esempio n. 1
0
        public async Task <RedirectResult> RegistrationDetails_POST(RegisterModel model)
        {
            if (CurrentRequestData.CurrentUser != null)
            {
                TempData["already-logged-in"] = _stringResourceProvider.GetValue("Register Already Logged in", "You are already logged in. Please logout to create a new account.");
                return(Redirect(UniquePageHelper.GetUrl <RegisterPage>()));
            }

            if (model != null && ModelState.IsValid && _registrationService.CheckEmailIsNotRegistered(model.Email))
            {
                await _registrationService.RegisterUser(model);

                return(!string.IsNullOrEmpty(model.ReturnUrl)
                    ? Redirect("~/" + model.ReturnUrl)
                    : Redirect("~/"));
            }
            return(Redirect(UniquePageHelper.GetUrl <RegisterPage>()));
        }
        public async Task <RegisterAndAssociateOrderResult> RegisterAndAssociateOrder(RegisterModel model, Order order)
        {
            if (!_registrationService.CheckEmailIsNotRegistered(model.Email))
            {
                return new RegisterAndAssociateOrderResult
                       {
                           Error = "The provided email already has an account associated"
                       }
            }
            ;

            var registeredUser = await _registrationService.RegisterUser(model);

            order.User = registeredUser;
            _session.Transact(session => session.Update(order));
            return(new RegisterAndAssociateOrderResult());
        }