コード例 #1
0
        [ResponseType(typeof (void))] //TODO: return userinfo?
        public async Task<IHttpActionResult> RegisterAsync(UserModel userModel)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            var identityResult = await _userRepository.RegisterUserAsync(userModel);
            var errorResult = GetErrorResult(identityResult);

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

            return Ok();
        }
コード例 #2
0
 public async Task<IdentityResult> RegisterUserAsync(UserModel userModel)
 {
     var user = new ApplicationUser(userModel.Username);
     return await _userManager.CreateAsync(user, userModel.Password);
 }