public void SubeEkle(string subeAdi) { Sube sube = new Sube(subeAdi); Subeler.Add(sube); var connectionString = @"Server = DESKTOP-NCH3S9Q\SQLEXPRESS; Database = EgitimKayit; Integrated Security = true; "; var commandtext = "INSERT INTO Subeler(Id,SubeAdi) VALUES('" + sube.Id + "','" + sube.SubeAdi + "')"; SqlConnection con = new SqlConnection(connectionString); con.Open(); SqlCommand command = new SqlCommand(commandtext, con); command.ExecuteNonQuery(); con.Close(); }
public List <Sube> SubeGetir() { Subeler.Clear(); var connectionString = @"Server = DESKTOP-NCH3S9Q\SQLEXPRESS; Database = EgitimKayit; Integrated Security = true; "; SqlConnection con = new SqlConnection(connectionString); con.Open(); SqlCommand command = new SqlCommand("SELECT * FROM Subeler", con); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { Sube sube = new Sube(reader.GetGuid(0).ToString(), reader.GetString(1)); Subeler.Add(sube); } con.Close(); return(Subeler); }
public Egitim(Ders Ders, Ogretmen Ogretmen, Sube Sube) { if (Ders == null) { throw new ArgumentNullException(nameof(Ders)); } if (Ogretmen == null) { throw new ArgumentNullException(nameof(Ogretmen)); } if (Sube == null) { throw new ArgumentNullException(nameof(Sube)); } this.Ders = Ders; this.Ogretmen = Ogretmen; this.Sube = Sube; Ogrenciler = new List <Ogrenci>(); }