Esempio n. 1
0
        public async Task<IdentityResult> RegisterUser(Login login)
        {
            IdentityUser user = new IdentityUser
            {
                UserName = login.username
            };
            var result = await _userManager.CreateAsync(user, login.password);

            return result;
        }
Esempio n. 2
0
        public async Task<IHttpActionResult> Register(Login login)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            IdentityResult result = await _repo.RegisterUser(login);

            IHttpActionResult errorResult = GetErrorResult(result);

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

            return Ok();
        }