예제 #1
0
        // GET: JenisTanah
        public ActionResult Index()
        {
            if ((bool)Session["Login"])
            {
                MetaniContext context = new MetaniContext();
                return(View(context.GetAllJenisTanah()));
            }

            return(RedirectToAction("Login", "Admin"));
        }
        // GET: Tanah/Edit/5
        public ActionResult Edit(int id)
        {
            if ((bool)Session["Login"])
            {
                MetaniContext     context    = new MetaniContext();
                List <JenisTanah> jenisTanah = context.GetAllJenisTanah();
                List <Lokasi>     lokasi     = context.GetAllLokasiTani();
                Tanah             tanah      = context.FindTanah(id);

                TanahLokasi tanahLokasi = new TanahLokasi {
                    jenisTanah = jenisTanah.ToArray(), lokasi = lokasi.ToArray(), tanah = tanah
                };

                return(View(tanahLokasi));
            }

            return(RedirectToAction("Login", "Admin"));
        }