示例#1
0
        public async Task <IActionResult> CreateAccount([FromBody] ApplicationUserDto applicationUserDto)
        {
            var applicationUser = _mapper.Map <ApplicationUser>(applicationUserDto);

            var identityResult = await _applicationUserService
                                 .CreateApplicationUserAsync(applicationUser, applicationUserDto.Password);

            if (!identityResult.Succeeded)
            {
                return(BadRequest());
            }

            applicationUserDto = _mapper.Map <ApplicationUserDto>(applicationUser);
            return(StatusCode(StatusCodes.Status201Created, applicationUserDto));
        }