public ActionResult Delete(int id, FormCollection collection) { if ((bool)Session["Login"]) { try { MetaniContext context = new MetaniContext(); context.DeleteHasilTani(id); return(RedirectToAction("Index")); } catch { return(View()); } } return(RedirectToAction("Login", "Admin")); }