public IActionResult PersonelGetir(int id)
        {
            Models.TblPersonel personel = new Models.TblPersonel();
            personel = db.TblPersonels.Find(Convert.ToByte(id));

            return(View("PersonelGetir", personel));
        }
        public ActionResult PersonelGuncelle(Models.TblPersonel y)
        {
            Models.TblPersonel personel = new Models.TblPersonel();

            personel          = db.TblPersonels.Find(y.Id);
            personel.Personel = y.Personel;
            personel.Username = y.Username;
            personel.Password = y.Password;
            db.SaveChanges();
            return(RedirectToAction("PersonelIndex", "Personel"));
        }
        public IActionResult Login(Models.TblPersonel admin)
        {
            int result     = 0;
            var adminLogin = db.TblPersonels.FirstOrDefault(x => x.Username == admin.Username && x.Password == admin.Password);

            result = adminLogin.Id > 0 ? adminLogin.Id : 0;

            if (result != 0 && result > 0)
            {
                HttpContext.Session.SetInt32("LoginKontrol", result);
                return(RedirectToAction("Index", "Home"));
            }
            return(View());
        }
        public ActionResult PersonelSil(int id)
        {
            if (id > 0)
            {
                Models.TblPersonel personel = new Models.TblPersonel();
                personel = db.TblPersonels.Find(Convert.ToByte(id));
                if (personel != null)
                {
                    db.TblPersonels.Remove(personel);
                }
                db.SaveChanges();
            }

            return(RedirectToAction("PersonelIndex", "Personel"));
        }
 public ActionResult PersonelEkle(Models.TblPersonel pers)
 {
     db.TblPersonels.Add(pers);
     db.SaveChanges();
     return(RedirectToAction("PersonelIndex", "Personel"));
 }