public ActionResult DeleteConfirmed(long id) { //Horizon horizon = db.Horizons.Find(id); //db.Horizons.Remove(horizon); //db.SaveChanges(); HorizonConfiguration hc = new HorizonConfiguration(); Horizon horizon = db.Horizons.Find(id); hc.Disable(horizon); db.SaveChanges(); return(Redirect("/Horizons")); }
// GET: Soils/Details/5 public ActionResult Details(long?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Soil soil = db.Soils.Find(id); if (soil == null) { return(HttpNotFound()); } HorizonConfiguration hc = new HorizonConfiguration(); SoilViewModel vm = new SoilViewModel(soil); vm.Farms = this.LoadFarms(soil.FarmId, soil.Farm); vm.Horizonts = hc.GetHorizonListBy(soil); return(View("~/Views/Agriculture/Soils/Details.cshtml", vm)); }