public static void silMusteri(int id) { Proje.DataAccess.otoservisdbEntities db = new Proje.DataAccess.otoservisdbEntities(); using (db) { List <int> query1 = (from arac in db.aracs where arac.musteriID == id select arac.aracID).ToList(); if (query1.Count == 0) { musteri m = new musteri(); var x = db.musteris.Find(id); db.musteris.Remove(x); db.SaveChanges(); } else if (query1.Count != 0) { int count1 = query1.Count; for (int i = 0; i < count1; i++) { //arackayit.silAracKayit(query1[i]); } var x = db.musteris.Find(id); db.musteris.Remove(x); db.SaveChanges(); } } }
public static void guncelleMusteri(int id, string tc, string ad) { Proje.DataAccess.otoservisdbEntities db = new Proje.DataAccess.otoservisdbEntities(); using (db) { var x = db.musteris.Find(id); x.tckn = tc; x.adSoyad = ad; db.SaveChanges(); } }
public static void AddMusteri(string tc, string ad) { Proje.DataAccess.otoservisdbEntities db = new Proje.DataAccess.otoservisdbEntities(); using (db) { musteri m = new musteri(); //m.musteriID = id; m.tckn = tc; m.adSoyad = ad; db.musteris.Add(m); db.SaveChanges(); } }