public ActionResult DeleteConfirmed(int id)
        {
            Crops_tbl crops_tbl = db.Crops_tbl.Find(id);

            db.Crops_tbl.Remove(crops_tbl);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        // GET: /Crops/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Crops_tbl crops_tbl = db.Crops_tbl.Find(id);

            if (crops_tbl == null)
            {
                return(HttpNotFound());
            }
            return(View(crops_tbl));
        }
        public ActionResult Create([Bind(Include = "CropsName,Description")] Crops_tbl crops_tbl)
        {
            if (ModelState.IsValid)
            {
                if (Session["User"] != null)
                {
                    User_tbl objUser = (User_tbl)Session["User"];
                    ViewBag.UserName = objUser.FullName;
                }
                db.Crops_tbl.Add(crops_tbl);
                db.SaveChanges();
                return(RedirectToAction("Create"));
            }

            // ViewBag.CropsCatagoryId = new SelectList(db.CropsCatagory_tbl, "CropsCatagoryId", "CropsCatagoryName", crops_tbl.CropsCatagoryId);
            return(View(crops_tbl));
        }
 // GET: /Crops/Delete/5
 public ActionResult Delete(int?id)
 {
     if (Session["User"] != null)
     {
         User_tbl objUser = (User_tbl)Session["User"];
         ViewBag.UserName = objUser.FullName;
         if (id == null)
         {
             return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
         }
         Crops_tbl crops_tbl = db.Crops_tbl.Find(id);
         if (crops_tbl == null)
         {
             return(HttpNotFound());
         }
         return(View(crops_tbl));
     }
     return(RedirectToAction("Login", "Login"));
 }
        // GET: /Crops/Edit/5
        public ActionResult Edit(int?id)
        {
            if (Session["User"] != null)
            {
                User_tbl objUser = (User_tbl)Session["User"];
                ViewBag.UserName = objUser.FullName;

                if (id == null)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }
                Crops_tbl crops_tbl = db.Crops_tbl.Find(id);
                if (crops_tbl == null)
                {
                    return(HttpNotFound());
                }
                // ViewBag.CropsCatagoryId = new SelectList(db.CropsCatagory_tbl, "CropsCatagoryId", "CropsCatagoryName", crops_tbl.CropsCatagoryId);
                return(View(crops_tbl));
            }
            return(RedirectToAction("Login", "Login"));
        }
        public ActionResult Edit([Bind(Include = "CropsId,CropsName,Description")] Crops_tbl crops_tbl)
        {
            if (Session["User"] != null)
            {
                User_tbl objUser = (User_tbl)Session["User"];
                ViewBag.UserName = objUser.FullName;
                if (ModelState.IsValid)
                {
                    db.Entry(crops_tbl).State = EntityState.Modified;
                    db.SaveChanges();
                    return(View(crops_tbl));
                }
            }
            else
            {
                return(RedirectToAction("Login", "Login"));
            }

            //  ViewBag.CropsCatagoryId = new SelectList(db.CropsCatagory_tbl, "CropsCatagoryId", "CropsCatagoryName", crops_tbl.CropsCatagoryId);
            return(View(crops_tbl));
        }