public bool Guncelle(Adminmodel p, int AdmId) { try { MotorContext ctx = new MotorContext(); Adminmodel adm = ctx.Admins.Find(AdmId); if (adm != null) { int sonuc = ctx.SaveChanges(); if (sonuc > 0) { return(true); } else { return(false); } } else { return(false); } } catch (Exception) { throw; } }
public bool Sil(Adminmodel adm) { try { MotorContext ctx = new MotorContext(); ctx.Admins.Remove(adm); return(ctx.SaveChanges() > 0); } catch (Exception) { throw; } }
public bool AdminEkle(Adminmodel prs) { try { MotorContext ctx = new MotorContext(); ctx.Admins.Add(prs); return(ctx.SaveChanges() > 0); } catch (Exception) { throw; } }
public List <Adminmodel> Listele() { try { MotorContext ctx = new MotorContext(); List <Adminmodel> lst = ctx.Admins.ToList(); if (lst != null) { return(lst); } else { return(null); } } catch (Exception) { throw; } }