// GET: Lokasi
        public ActionResult Index()
        {
            if ((bool)Session["Login"])
            {
                MetaniContext context = new MetaniContext();
                return(View(context.GetAllLokasiTani()));
            }

            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"));
        }
        // GET: JenisTani/Create
        public ActionResult Create()
        {
            if ((bool)Session["Login"])
            {
                MetaniContext    context   = new MetaniContext();
                List <JenisTani> jenisTani = context.GetAllJenisTani();
                List <Lokasi>    lokasi    = context.GetAllLokasiTani();

                HasilTani hasilTani = new HasilTani();

                TaniLokasi taniLokasi = new TaniLokasi {
                    jenisTani = jenisTani.ToArray(), lokasi = lokasi.ToArray(), hasilTani = hasilTani
                };
                return(View(taniLokasi));
            }

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