예제 #1
0
        static void Main(string[] args)
        {
            int angka = 0;

            Console.WriteLine("Masukan angka");
            string inputan = Console.ReadLine();

            int.TryParse(inputan, out angka);

            //angka = angka < angka;

            for (int i = 0; i < angka; i++)
            {
                Console.WriteLine("angka= " + i + ", kuadrat=" + Math.Pow(i, 2));
            }

            // Mahasiswa budi = new Mahasiswa();
            // Mahasiswa iwan = new Mahasiswa();
            // Mahasiswa wati = new Mahasiswa();
            // Mahasiswa Badu = new Mahasiswa();
            // budi.menulis();
            // Console.WriteLine(Badu.membaca());
            // Badu.bernafas();

            // DutaKampus widya = new Dutakampus();
            // Console.WriteLine(widya.membaca());
            // widya.mempromosikan();

            Desa desa = new Desa();

            desa.namaDesa();
            desa.namakota();
            desa.namaprovinsi();
        }
예제 #2
0
        public async Task <ActionResult> DeleteConfirmed(string id)
        {
            Desa desa = await db.Desas.FindAsync(id);

            db.Desas.Remove(desa);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
예제 #3
0
 public void Add(Desa entity)
 {
     entity.RecordStatus = "A";
     using (var context = new AISContext <Desa>())
     {
         context.DBEntities.Add(entity);
         context.SaveChanges();
     }
 }
예제 #4
0
        public async Task <ActionResult> Edit([Bind(Include = "KodeDesa,KodeKec,NamaDesa,KearifanLokal")] Desa desa)
        {
            if (ModelState.IsValid)
            {
                db.Entry(desa).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewBag.KodeKec = new SelectList(db.Kecamatans, "KodeKec", "KodeKab", desa.KodeKec);
            return(View(desa));
        }
예제 #5
0
        // GET: Desa/Details/5
        public async Task <ActionResult> Details(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Desa desa = await db.Desas.FindAsync(id);

            if (desa == null)
            {
                return(HttpNotFound());
            }
            return(View(desa));
        }
예제 #6
0
        // GET: Desa/Edit/5
        public async Task <ActionResult> Edit(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Desa desa = await db.Desas.FindAsync(id);

            if (desa == null)
            {
                return(HttpNotFound());
            }
            ViewBag.KodeKec = new SelectList(db.Kecamatans, "KodeKec", "KodeKab", desa.KodeKec);
            return(View(desa));
        }
예제 #7
0
        public void Update(Desa entity)
        {
            using (var context = new AISContext <Desa>())
            {
                Desa data = context.DBEntities.Where(i => i.IDDesa == entity.IDDesa).FirstOrDefault();

                if (data == null)
                {
                    //TBD for error exception data not exist
                    throw new Exception("Data Not Exist");
                }
                else
                {
                    data.RecordStatus = entity.RecordStatus.Substring(0, 1);
                    data.IDKecamatan  = entity.IDKecamatan;
                    data.NamaDesa     = entity.NamaDesa;
                    context.SaveChanges();
                }
            }
        }
예제 #8
0
        // GET:
        public async Task <ActionResult> Profil(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Desa desa = await db.Desas.FindAsync(id);

            List <Indikator> indikators = await db.Indikators.Where(x => x.KodeDesa == id).ToListAsync();

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

            ViewBag.desa       = desa;
            ViewBag.indikators = indikators;

            return(View());
        }
예제 #9
0
 public void Delete(Desa entity)
 {
     throw new NotImplementedException();
 }