public ActionResult Create(Plant plant) { //TryUpdateModel(plant); if (ModelState.IsValid) { PlantContext plantContext = new PlantContext(); plantContext.AddPlant(plant); return RedirectToAction("Index"); } return View(); }
// // GET: /Plant/ public ActionResult Index() { PlantContext plantContext = new PlantContext(); List<Plant> plants = plantContext.plants.ToList(); return View(plants); }
public ActionResult Details(int id) { PlantContext plantContext = new PlantContext(); Plant plant = plantContext.plants.Single(x => x.Id == id); return View(plant); }