Beispiel #1
0
        public ActionResult Kaydet(personel personel)
        {
            if (!ModelState.IsValid)
            {
                var model = new PersonelFromViewModel()
                {
                    Departmanlar = db.Departman.ToList(),
                    Personel     = personel
                };
                return(View("PersonelForm", model));
            }

            if (personel.p_no == 0)
            {
                db.personel.Add(personel);
            }
            else
            {
                if (personel == null)
                {
                    return(HttpNotFound());
                }
                else
                {
                    db.Entry(personel).State = System.Data.Entity.EntityState.Modified;
                }
            }
            db.SaveChanges();
            return(RedirectToAction("PersonelList"));
        }
Beispiel #2
0
        public ActionResult YeniP()
        {
            var model = new PersonelFromViewModel()
            {
                Departmanlar = db.Departman.ToList(),
                Personel     = new personel()
            };

            return(View("PersonelForm", model));
        }
Beispiel #3
0
        public ActionResult Güncelle(int id)
        {
            var model = new PersonelFromViewModel()
            {
                Departmanlar = db.Departman.ToList(),
                Personel     = db.personel.Find(id)
            };

            if (model == null)
            {
                return(HttpNotFound());
            }
            return(View("PersonelForm", model));
        }