Exemplo n.º 1
0
        public async Task <IActionResult> AddNewUser([FromBody] User user)
        {
            user.CreateId();

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            await _userElasticRepository.Add(user);

            _logger.LogInformation("New user was added successfully.");

            return(CreatedAtAction(nameof(GetUserById), new { id = user.Id }, user));
        }