コード例 #1
0
        public async Task <IActionResult> CreateUser(UserDto userDto)
        {
            try
            {
                var user = await _serviceManageUser.CreateUser(userDto);

                return(CreatedAtAction(nameof(GetUserById), new { id = user.Id }, user));
            }
            catch (Exception ex)
            {
                var exception = ex;

                return(BadRequest("Erro ao criar o usuário"));
            }
        }
コード例 #2
0
        public void CreateUSerIfNotExist()
        {
            var users = _serviceManageUser.GetUsers().Result;

            if (!users.Any())
            {
                var userDto = new UserDto()
                {
                    Email = "*****@*****.**",
                    Login = "******",
                    Nome  = "Admin",
                    Senha = "Admin123"
                };

                var user = _serviceManageUser.CreateUser(userDto).Result;
            }
        }