Example #1
0
 //-------------------------------------------------------------//
 public static List <Doktor> TumDoktorlariGetir()
 {
     using (HastaneDbContext db = new HastaneDbContext())
     {
         return(db.doktorlar.ToList());
     }
 }
Example #2
0
 public static Doktor AdinaGoreDoktorGetir(string adi)
 {
     using (HastaneDbContext db = new HastaneDbContext())
     {
         return(db.doktorlar.FirstOrDefault(d => d.Adi == adi));
         //from h in hastalar where h.id == id anlamına geliyor
     }
 }
Example #3
0
 //-------------------------------------------------------------//
 public static void DoktorDuzenle(Doktor doktor)
 {
     using (HastaneDbContext db = new HastaneDbContext())
     {
         db.Entry <Doktor>(doktor).State = EntityState.Modified;
         db.SaveChanges();
     }
 }
Example #4
0
 //-------------------------------------------------------------//
 public static Doktor IdIleDoktorGetir(int ID)
 {
     using (HastaneDbContext db = new HastaneDbContext())
     {
         return(db.doktorlar.FirstOrDefault(d => d.ID == ID));
         //from h in hastalar where h.id == id anlamına geliyor
     }
 }
Example #5
0
 public static void Ekle(Doktor doktor)
 {
     using (HastaneDbContext db = new HastaneDbContext())
     {
         db.doktorlar.Add(doktor);
         db.SaveChanges();
     }
 }
Example #6
0
 public static void Sil(Doktor doktor)
 {
     using (HastaneDbContext db = new HastaneDbContext())
     {
         db.doktorlar.Remove(doktor);
         //db.Entry<Hasta>(hasta).State = EntityState.Deleted;
         db.SaveChanges();
     }
 }