コード例 #1
0
 public IActionResult TambahPertanyaanWawancara(RincianSoalWawancaraModel model)
 {
     if (!ModelState.IsValid)
     {
         TempData["Pesan"] = "Data tidak valid";
     }
     else
     {
         var newPertanyaan = new Pertanyaan()
         {
             SoalId = model.Id,
             Isi    = model.CrudPertanyaanWawancara.Isi
         };
         _soalService.AddPertanyaan(newPertanyaan);
     }
     return(RedirectToAction(nameof(RincianSoalWawancara), new { id = model.Id }));
 }
コード例 #2
0
        public IActionResult RincianSoalWawancara(int id)
        {
            ViewBag.Pesan = TempData["Pesan"] as string;
            var soal  = _soalService.GetDetailSoal(id);
            var model = new RincianSoalWawancaraModel()
            {
                Id                      = soal.Id,
                JudulSoal               = soal.Judul,
                Jalur                   = soal.Jalur,
                Target                  = soal.Target,
                JumlahPertanyaan        = soal.JumlahPertanyaan,
                Deskripsi               = soal.Deskripsi,
                ListPertanyaanWawancara = soal.ListPertanyaan
                                          .Select(x => new CrudPertanyaanWawancaraModel()
                {
                    Id     = x.Id,
                    Isi    = x.Isi,
                    SoalId = x.SoalId
                }).ToList()
            };

            return(View(model));
        }