Exemplo n.º 1
0
        public ActionResult Kayit()
        {
            var model = new CalisanKayitViewModel
            {
                Calisanlar   = _calisanService.GetAll(),
                Departmanlar = _departmanService.GetAll(),
                Calisan      = new Calisan()
            };

            return(View(model));
        }
Exemplo n.º 2
0
 public ActionResult Kayit(CalisanKayitViewModel model)
 {
     if (ModelState.IsValid)
     {
         _calisanService.Add(model.Calisan);
         TempData.Add("message", String.Format("{0} adlı çalışan kaydınız eklenmiştir.", model.Calisan.Ad));
         return(RedirectToAction("Liste"));
     }
     else
     {
         ModelState.AddModelError("", "Çalışan kaydınız oluşturulamadı!");
         model.Calisanlar   = _calisanService.GetAll();
         model.Departmanlar = _departmanService.GetAll();
         return(View(model));
     }
 }