Exemple #1
0
        // GET: Admin/ServisForm/Create
        public ActionResult Create()
        {
            using (MusteriRepository repo = new MusteriRepository())
            {
                var liste = repo.Listele(x => !x.Silindi);
                ViewBag.Musteriler = new SelectList(liste, "Id", "FirmaAdi");;
            }

            using (ServisTipRepository repo = new ServisTipRepository())
            {
                var liste = repo.Listele(x => !x.Silindi);
                ViewBag.ServisTipleri = new SelectList(liste, "Id", "Adi");;
            }

            using (ServisIcerikRepository repo = new ServisIcerikRepository())
            {
                var liste = repo.Listele(x => !x.Silindi);
                ViewBag.ServisIcerikleri = new SelectList(liste, "Id", "Adi");;
            }

            using (ServisSekliRepository repo = new ServisSekliRepository())
            {
                var liste = repo.Listele(x => !x.Silindi);
                ViewBag.ServisSekilleri = new SelectList(liste, "Id", "Adi");;
            }

            using (BakimAnlasmaRepository repo = new BakimAnlasmaRepository())
            {
                var liste = repo.Listele(x => !x.Silindi);
                ViewBag.BakimAnlasmalari = new SelectList(liste, "Id", "Musterisi.FirmaAdi");;
            }

            return(View());
        }
Exemple #2
0
        public ActionResult Create(ServisForm model)
        {
            try
            {
                using (ServisFormRepository repo = new ServisFormRepository())
                {
                    model.KayitTarihi = DateTime.Now;
                    model.KullaniciId = ((Kullanici)Session["User"]).Id;
                    repo.Ekle(model);
                }


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

                using (ServisTipRepository repo = new ServisTipRepository())
                {
                    var liste = repo.Listele(x => !x.Silindi);
                    ViewBag.ServisTipleri = new SelectList(liste, "Id", "Adi");;
                }

                using (ServisIcerikRepository repo = new ServisIcerikRepository())
                {
                    var liste = repo.Listele(x => !x.Silindi);
                    ViewBag.ServisIcerikleri = new SelectList(liste, "Id", "Adi");;
                }

                using (ServisSekliRepository repo = new ServisSekliRepository())
                {
                    var liste = repo.Listele(x => !x.Silindi);
                    ViewBag.ServisSekilleri = new SelectList(liste, "Id", "Adi");;
                }

                using (BakimAnlasmaRepository repo = new BakimAnlasmaRepository())
                {
                    var liste = repo.Listele(x => !x.Silindi);
                    ViewBag.BakimAnlasmalari = new SelectList(liste, "Id", "Musterisi.FirmaAdi");;
                }
                return(View(model));
            }
        }
Exemple #3
0
        public ActionResult Edit(int id, ServisForm model)
        {
            try
            {
                using (var repo = new ServisFormRepository())
                {
                    model.GuncellemeTarihi = DateTime.Now;
                    repo.Guncelle(model);
                }

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

                using (ServisTipRepository repo = new ServisTipRepository())
                {
                    var liste = repo.Listele(x => !x.Silindi);
                    ViewBag.ServisTipleri = new SelectList(liste, "Id", "Adi");;
                }

                using (ServisIcerikRepository repo = new ServisIcerikRepository())
                {
                    var liste = repo.Listele(x => !x.Silindi);
                    ViewBag.ServisIcerikleri = new SelectList(liste, "Id", "Adi");;
                }

                using (ServisSekliRepository repo = new ServisSekliRepository())
                {
                    var liste = repo.Listele(x => !x.Silindi);
                    ViewBag.ServisSekilleri = new SelectList(liste, "Id", "Adi");;
                }

                using (BakimAnlasmaRepository repo = new BakimAnlasmaRepository())
                {
                    var liste = repo.Listele(x => !x.Silindi);
                    ViewBag.BakimAnlasmalari = new SelectList(liste, "Id", "Musterisi.FirmaAdi");;
                }
                return(View(model));
            }
        }
Exemple #4
0
        // GET: Admin/ServisForm/Edit/5
        public ActionResult Edit(int id)
        {
            using (MusteriRepository repo = new MusteriRepository())
            {
                var liste = repo.Listele(x => !x.Silindi);
                ViewBag.Musteriler = new SelectList(liste, "Id", "FirmaAdi");;
            }

            using (ServisTipRepository repo = new ServisTipRepository())
            {
                var liste = repo.Listele(x => !x.Silindi);
                ViewBag.ServisTipleri = new SelectList(liste, "Id", "Adi");;
            }

            using (ServisIcerikRepository repo = new ServisIcerikRepository())
            {
                var liste = repo.Listele(x => !x.Silindi);
                ViewBag.ServisIcerikleri = new SelectList(liste, "Id", "Adi");;
            }

            using (ServisSekliRepository repo = new ServisSekliRepository())
            {
                var liste = repo.Listele(x => !x.Silindi);
                ViewBag.ServisSekilleri = new SelectList(liste, "Id", "Adi");;
            }

            using (BakimAnlasmaRepository repo = new BakimAnlasmaRepository())
            {
                var liste = repo.Listele(x => !x.Silindi);
                ViewBag.BakimAnlasmalari = new SelectList(liste, "Id", "Musterisi.FirmaAdi");;
            }

            using (var repo = new ServisFormRepository())
            {
                var model = repo.Getir(x => x.Id == id);
                return(View(model));
            }
        }