예제 #1
0
        public async Task <IActionResult> RegisterUser(RegisterAsUserInputModel model)
        {
            if (!ModelState.IsValid)
            {
                return(this.View(model));
            }

            await this.accountService.CreateUser(model.Email, model.Username, model.FirstName, model.LastName, model.Password);

            return(this.Redirect(Constants.loginUrl));
        }
예제 #2
0
        public async Task <IActionResult> RegisterUser(RegisterAsUserInputModel model)
        {
            if (!this.ModelState.IsValid)
            {
                return(this.View(model));
            }
            if (accountService.CheckIfUsernameIsAvailable(model.Username))
            {
                ModelState.AddModelError("Username", "Username already exists.");
                return(View(model));
            }

            await this.accountService.CreateUser(model.Username, model.FirstName, model.LastName,
                                                 model.Email, model.PhoneNumber, model.Password);

            return(this.Redirect(GlobalConstants.loginUrl));
        }