public IActionResult Register([FromBody] Users user) { if (user == null) { return(InvalidClientRequest()); } LoginModel loginModel = new LoginModel { Login = user.Email, Password = user.PasswordHash }; string userId = Guid.NewGuid().ToString("N"); string hashedPassword = _helper.ComputeSha256Hash(user.PasswordHash); UserSettings userSettings = new UserSettings { LearningLanguageId = 0, NativeLanguageId = 0, UserId = userId }; user.Id = userId; user.UserSettings = new List <UserSettings> { userSettings }; user.PasswordHash = hashedPassword; using (ProductHouseContext db = new ProductHouseContext()) { db.Users.Add(user); db.SaveChanges(); } return(Login(loginModel)); }