Пример #1
0
        public async Task <IActionResult> Create([FromBody] HeaderRequest request)
        {
            UsernameEntity user = new UsernameEntity()
            {
                Username = request.Username,
                Email    = request.Email
            };
            bool check = await _user.CheckUser(user);

            if (check)
            {
                string id = await _user.addUser(user);

                if (!string.IsNullOrEmpty(id))
                {
                    PasswordEntity pass = new PasswordEntity()
                    {
                        UserId   = id,
                        Password = BCrypt.Net.BCrypt.HashPassword(request.Password, 11)
                    };

                    int wait = await _pass.CreatePassword(pass);

                    return(Ok());
                }
            }

            return(BadRequest("User"));
        }