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 static rAdminmodel Getir(Adminmodel admin) { try { return(AdminDAL.Getir(admin)); } catch (Exception) { throw; } }
public ActionResult Index(Adminmodel admin) { var sonuc = AdminBl.Getir(admin); if (sonuc != null && sonuc.Id > 0) { Session["Admin"] = sonuc.KullanıcıAdı; return(Redirect("/Home/Index")); } return(View()); }
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 static rAdminmodel Getir(Adminmodel admin) { MotorContext ctx = new MotorContext(); var sorgu = from a in ctx.Admins where a.KullanıcıAdı == admin.KullanıcıAdı && a.Sifre == admin.Sifre select new rAdminmodel { KullanıcıAdı = a.KullanıcıAdı, Sifre = a.Sifre, Eposta = a.Eposta, Id = a.Id }; return(sorgu.FirstOrDefault()); }