public ActionResult Edit([Bind(Include = "Id,NobetGrupGorevTipId,NobetGunKuralId,NobetUstGrupGunGrupId,BaslangicTarihi,BitisTarihi,NobetciSayisi")] NobetGrupGorevTipGunKural nobetGrupGorevTipGunKural)
        {
            if (ModelState.IsValid)
            {
                _nobetGrupGorevTipGunKuralService.Update(nobetGrupGorevTipGunKural);
                return(RedirectToAction("Index"));
            }

            var nobetUstGrup           = _nobetUstGrupSessionService.GetSession("nobetUstGrup");
            var nobetGrupGorevTipler   = _nobetGrupGorevTipService.GetDetaylar(nobetUstGrup.Id);
            var nobetUstGrupGunGruplar = _nobetUstGrupGunGrupService.GetDetaylar(nobetUstGrup.Id);

            ViewBag.NobetGrupGorevTipId   = new SelectList(nobetGrupGorevTipler, "Id", "NobetGrupGorevTipAdi", nobetGrupGorevTipGunKural.NobetGrupGorevTipId);
            ViewBag.NobetGunKuralId       = new SelectList(_nobetGunKuralService.GetList(), "Id", "Adi", nobetGrupGorevTipGunKural.NobetGunKuralId);
            ViewBag.NobetUstGrupGunGrupId = new SelectList(nobetUstGrupGunGruplar, "Id", "GunGrupAdi", nobetGrupGorevTipGunKural.NobetUstGrupGunGrupId);
            return(View(nobetGrupGorevTipGunKural));
        }
        public ActionResult Edit(int id)
        {
            if (id < 1)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            NobetGrupGorevTipGunKural nobetGrupGorevTipGunKural = _nobetGrupGorevTipGunKuralService.GetById(id);

            if (nobetGrupGorevTipGunKural == null)
            {
                return(HttpNotFound());
            }
            var nobetUstGrup           = _nobetUstGrupSessionService.GetSession("nobetUstGrup");
            var nobetGrupGorevTipler   = _nobetGrupGorevTipService.GetDetaylar(nobetUstGrup.Id);
            var nobetUstGrupGunGruplar = _nobetUstGrupGunGrupService.GetDetaylar(nobetUstGrup.Id);

            ViewBag.NobetGrupGorevTipId   = new SelectList(nobetGrupGorevTipler, "Id", "NobetGrupGorevTipAdi", nobetGrupGorevTipGunKural.NobetGrupGorevTipId);
            ViewBag.NobetGunKuralId       = new SelectList(_nobetGunKuralService.GetList(), "Id", "Adi", nobetGrupGorevTipGunKural.NobetGunKuralId);
            ViewBag.NobetUstGrupGunGrupId = new SelectList(nobetUstGrupGunGruplar, "Id", "GunGrupAdi", nobetGrupGorevTipGunKural.NobetUstGrupGunGrupId);
            return(View(nobetGrupGorevTipGunKural));
        }
        public ActionResult Create([Bind(Include = "Id,NobetGrupGorevTipId,NobetGunKuralId,NobetUstGrupGunGrupId,BaslangicTarihi,BitisTarihi,NobetciSayisi")] NobetGrupGorevTipGunKural nobetGrupGorevTipGunKural)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    _nobetGrupGorevTipGunKuralService.Insert(nobetGrupGorevTipGunKural);
                }
                catch (DbUpdateException ex)
                {
                    var hata = ex.InnerException.ToString();

                    string[] dublicateHata = { "Cannot insert dublicate row in object", "with unique index" };

                    var dublicateRowHatasiMi = dublicateHata.Any(h => hata.Contains(h));

                    if (dublicateRowHatasiMi)
                    {
                        throw new Exception("<strong>Bir Nöbet Grubu için iki kural eklenemez...</strong>");
                    }

                    throw ex;
                }
                catch (Exception ex)
                {
                    throw ex;
                }

                return(RedirectToAction("Index"));
            }

            var nobetUstGrup           = _nobetUstGrupSessionService.GetSession("nobetUstGrup");
            var nobetGrupGorevTipler   = _nobetGrupGorevTipService.GetDetaylar(nobetUstGrup.Id);
            var nobetUstGrupGunGruplar = _nobetUstGrupGunGrupService.GetDetaylar(nobetUstGrup.Id);

            ViewBag.NobetGrupGorevTipId   = new SelectList(nobetGrupGorevTipler, "Id", "NobetGrupGorevTipAdi", nobetGrupGorevTipGunKural.NobetGrupGorevTipId);
            ViewBag.NobetGunKuralId       = new SelectList(_nobetGunKuralService.GetList(), "Id", "Adi", nobetGrupGorevTipGunKural.NobetGunKuralId);
            ViewBag.NobetUstGrupGunGrupId = new SelectList(nobetUstGrupGunGruplar, "Id", "GunGrupAdi", nobetGrupGorevTipGunKural.NobetUstGrupGunGrupId);
            return(View(nobetGrupGorevTipGunKural));
        }
 public void Update(NobetGrupGorevTipGunKural nobetGrupGorevTipGunKural)
 {
     _nobetGrupGorevTipGunKuralDal.Update(nobetGrupGorevTipGunKural);
 }
 public void Insert(NobetGrupGorevTipGunKural nobetGrupGorevTipGunKural)
 {
     _nobetGrupGorevTipGunKuralDal.Insert(nobetGrupGorevTipGunKural);
 }