Exemplo n.º 1
0
 public ActionResult AnketDuzenle(int soruid, int anketid, string sorumetni)
 {
     try
     {
         var soruRepo   = new SoruRepo();
         var seciliSoru = soruRepo.GetById(soruid);
         seciliSoru.SoruMetni = sorumetni;
         soruRepo.Update();
         return(RedirectToAction("AnketDetay", new { id = anketid }));
     }
     catch (Exception)
     {
         return(RedirectToAction("Index"));
     }
 }
Exemplo n.º 2
0
        } //Taşınacak

        public ActionResult Anket(int?id, string userId)
        {
            var anket   = new AnketRepo().GetById(id.Value);
            var sorular = new SoruRepo().GetAll().Where(x => x.AnketID == id.Value).ToList();


            var model = new KullaniciAnketiViewModel()
            {
                anket   = anket,
                sorular = sorular,
                UserID  = userId
            };

            return(View(model));
        } //Taşınacak
Exemplo n.º 3
0
        public ActionResult AnketDetay(int?id)
        {
            if (id == null)
            {
                return(RedirectToAction("Index", "Anket"));
            }

            var seciliAnket = new AnketRepo().GetById(id.Value);
            var sorular     = new SoruRepo().GetAll().Where(x => x.AnketID == id.Value).ToList();
            var model       = new KullaniciAnketiViewModel()
            {
                anket   = seciliAnket,
                sorular = sorular
            };

            return(View(model));
        }
Exemplo n.º 4
0
        public ActionResult AnketEkle(AnketViewModel model)
        {
            var anketrepo = new AnketRepo();
            var sorurepo  = new SoruRepo();
            var yeniAnket = new Anket()
            {
                AnketIsmi = model.anketadi
            };

            anketrepo.Insert(yeniAnket);

            model.sorulistesi.ForEach(x =>
            {
                sorurepo.Insert(new Soru()
                {
                    SoruMetni = x.SoruMetni,
                    AnketID   = yeniAnket.ID,
                });
            });

            return(View());
        }