Beispiel #1
0
        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;
            }
        }
Beispiel #2
0
 public static rAdminmodel Getir(Adminmodel admin)
 {
     try
     {
         return(AdminDAL.Getir(admin));
     }
     catch (Exception)
     {
         throw;
     }
 }
Beispiel #3
0
        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());
        }
Beispiel #4
0
 public bool Sil(Adminmodel adm)
 {
     try
     {
         MotorContext ctx = new MotorContext();
         ctx.Admins.Remove(adm);
         return(ctx.SaveChanges() > 0);
     }
     catch (Exception)
     {
         throw;
     }
 }
Beispiel #5
0
 public bool AdminEkle(Adminmodel prs)
 {
     try
     {
         MotorContext ctx = new MotorContext();
         ctx.Admins.Add(prs);
         return(ctx.SaveChanges() > 0);
     }
     catch (Exception)
     {
         throw;
     }
 }
Beispiel #6
0
        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());
        }