Exemplo n.º 1
0
        public ActionResult Kayit()
        {
            var model = new DepartmanKayitViewModel
            {
                Departman = new Departman()
            };

            return(View(model));
        }
Exemplo n.º 2
0
        public ActionResult Kayit(DepartmanKayitViewModel model)
        {
            if (ModelState.IsValid)
            {
                _departmanService.Add(model.Departman);
                TempData.Add("message", String.Format("{0} adlı departman kaydınız eklenmiştir.", model.Departman.Ad));
                return(RedirectToAction("Liste"));
            }
            else
            {
                ModelState.AddModelError("", "Departman kaydınız oluşturulamadı!");

                return(View(model));
            }
        }