コード例 #1
0
        public ActionResult Edit(int id, BakimAnlasma model)
        {
            try
            {
                using (BakimAnlasmaRepository repo = new BakimAnlasmaRepository())
                {
                    model.GuncellemeTarihi = DateTime.Now;
                    repo.Guncelle(model);
                }

                return(RedirectToAction("Index"));
            }
            catch
            {
                using (MusteriRepository repo = new MusteriRepository())
                {
                    var musteriler = repo.Listele(x => !x.Silindi);
                    ViewBag.Musteriler = new SelectList(musteriler, "Id", "FirmaAdi");;
                }

                using (BakimAnlasmaTipRepository repo = new BakimAnlasmaTipRepository())
                {
                    var anlasmaTipleri = repo.Listele(x => !x.Silindi);
                    ViewBag.AnlasmaTipleri = new SelectList(anlasmaTipleri, "Id", "Adi");;
                }

                return(View(model));
            }
        }
コード例 #2
0
        public ActionResult Delete(int id, FormCollection fc)
        {
            try
            {
                using (var repo = new BakimAnlasmaRepository())
                {
                    var model = repo.Getir(x => x.Id == id);
                    model.Silindi = true;
                    repo.Guncelle(model);
                }

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }