예제 #1
0
        public ActionResult Index()
        {
            using (KecamatanDAL service = new KecamatanDAL())
            {
                var kec = service.GetData().ToList();


                return(View(kec));
            }
        }
예제 #2
0
        public ActionResult Create()
        {
            var lstKec = new List <SelectListItem>();

            using (KecamatanDAL svKec = new KecamatanDAL())
            {
                foreach (var kec in svKec.GetData())
                {
                    lstKec.Add(new SelectListItem
                    {
                        Value = kec.id_kec.ToString(),
                        Text  = kec.nama_kec
                    });
                }
                ViewBag.Kecamatan = lstKec;
            }

            return(View());
        }