コード例 #1
0
        // GET: Indikator/Details/5
        public async Task <ActionResult> Desa(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Indikator indikator = await db.Indikators.FindAsync(id);

            int        ids        = Int32.Parse(id);
            ProfilDesa profilDesa = new ProfilDesa();

            using (db)
            {
                var initquery = db.Indikators.Where(x => x.IdIndikator == ids);
                profilDesa.nm_kelompok = initquery?.SingleOrDefault().Penilaians?.SingleOrDefault()?.Akun?.Mahasiswas?.SingleOrDefault()?.KelompokKkn?.NamaKel ?? "";
                profilDesa.nm_program  = initquery?.SingleOrDefault()?.Penilaians?.SingleOrDefault()?.Program?.NamaProgram ?? "";
                profilDesa.skor        = initquery?.SingleOrDefault()?.Penilaians?.SingleOrDefault()?.Skor ?? 0;
            }

            if (indikator == null)
            {
                return(HttpNotFound());
            }

            ViewBag.indikator  = indikator;
            ViewBag.profilDesa = profilDesa;

            return(View());
        }
コード例 #2
0
        public async Task <ActionResult> DeleteConfirmed(string id)
        {
            Indikator indikator = await db.Indikators.FindAsync(id);

            db.Indikators.Remove(indikator);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
コード例 #3
0
        public async Task <ActionResult> Edit([Bind(Include = "KodeDesa,IdIndikator,Username,Judul,Deskripsi,Konfirmasi")] Indikator indikator)
        {
            if (ModelState.IsValid)
            {
                db.Entry(indikator).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewBag.Username = new SelectList(db.Akuns, "Username", "Email", indikator.Username);
            ViewBag.KodeDesa = new SelectList(db.Desas, "KodeDesa", "KodeKec", indikator.KodeDesa);
            return(View(indikator));
        }
コード例 #4
0
        // GET: Indikator/Delete/5
        public async Task <ActionResult> Delete(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Indikator indikator = await db.Indikators.FindAsync(id);

            if (indikator == null)
            {
                return(HttpNotFound());
            }
            return(View(indikator));
        }
コード例 #5
0
        // GET: Indikator/Edit/5
        public async Task <ActionResult> Edit(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Indikator indikator = await db.Indikators.FindAsync(id);

            if (indikator == null)
            {
                return(HttpNotFound());
            }
            ViewBag.Username = new SelectList(db.Akuns, "Username", "Email", indikator.Username);
            ViewBag.KodeDesa = new SelectList(db.Desas, "KodeDesa", "KodeKec", indikator.KodeDesa);
            return(View(indikator));
        }
コード例 #6
0
        public async Task <ActionResult> Indikator()
        {
            int IdIndikator = -1;

            Int32.TryParse(Request.QueryString["IdIndikator"], out IdIndikator);

            if (IdIndikator == -1)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Indikator indikator = await db.Indikators.Where(x => x.IdIndikator == IdIndikator).FirstOrDefaultAsync();

            List <IndikatorV> penilaian = await db.Penilaians.Where(x => x.IdIndikator == IdIndikator).Select(x => new IndikatorV {
                NamaProgram = x.Program.NamaProgram, NamaKel = x.Program.KelompokKkn.NamaKel, Skor = x.Skor, Alasan = x.Alasan, IdPenilaian = x.IdPenilaian
            }).ToListAsync();

            ViewBag.indikator = indikator;
            ViewBag.penilaian = penilaian;

            return(View());
        }