예제 #1
0
        public async Task <IActionResult> Post([FromBody] DTO.SignupModel user)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            Model.User entity = Mapper.Map <Model.User>(user);
            (string hashed, string salt) = await API.Services.HashPassword.HashAsync(user.Password);

            entity.Password = $"{hashed}.{salt}";

            entity = await dataAccess.AddAsync(entity);

            return(Created($"api/User/{entity.Id}", Mapper.Map <DTO.User>(entity)));
        }