示例#1
0
        public async Task<IdentityResult> RegisterUser(UserModel userModel)
        {
            var user = new ApplicationUser
            {
                UserName = userModel.Email.ToLower(),
                Email = userModel.Email
            };

            var result = await UserManager.CreateAsync(user, userModel.Password);

            return result;
        }
示例#2
0
        public async Task<IHttpActionResult> Register(UserModel userModel)
        {
            if (userModel == null || !ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            var result = await _authRepository.RegisterUser(userModel);

            var errorResult = GetErrorResult(result);

            if (errorResult != null)
            {
                return errorResult;
            }

            return Ok();
        }