public void SaveTrunsaction(TextBox TextPassword, TextBox TextName, TextBox TextEmail) { Users user = new Users(); user.password = HashPassword.HashPasswords(TextPassword.Text); user.UserName = TextName.Text; user.email = TextEmail.Text; unit.Sql.AddToDbUser(user); unit.Sql.SaveToDB(); Users.aktivePlyer = TextName.Text; WorkWithLearnWords.j = 0; IEnumerable <int> queryToUsers = unit.Sql.SelectUserId(TextName.Text); IEnumerable <int> queryToWords = unit.Sql.SelectWordId(); foreach (var us in queryToUsers) { foreach (var word in queryToWords) { UsersWords users = new UsersWords(); users.UserId = us; users.WordId = word; users.flag = false; unit.Sql.AddToDB(users); } } unit.Sql.SaveToDB(); TextName.Text = ""; TextPassword.Text = ""; TextEmail.Text = ""; }
public void AddToDB(UsersWords users) { db.UsersWords.Add(users); }