public void OgrenciEkle(string ad, int yas) { cehars_database1Entities entity1 = new cehars_database1Entities(); ogrenci ogrenci1 = new ogrenci(); int sonKayitId = (from ogrenci in entity1.ogrenci select ogrenci).OrderByDescending(ogrenci => ogrenci.id).ToList()[0].id; ogrenci1.id = sonKayitId + 1; ogrenci1.ad = ad; ogrenci1.yas = yas; entity1.ogrenci.AddObject(ogrenci1); entity1.SaveChanges(); }
/// <summary> /// Deprecated Method for adding a new object to the ogrenci EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToogrenci(ogrenci ogrenci) { base.AddObject("ogrenci", ogrenci); }
/// <summary> /// Create a new ogrenci object. /// </summary> /// <param name="id">Initial value of the id property.</param> public static ogrenci Createogrenci(global::System.Int32 id) { ogrenci ogrenci = new ogrenci(); ogrenci.id = id; return ogrenci; }