예제 #1
0
        public ActionResult Create(Plant plant)
        {
            //TryUpdateModel(plant);
            if (ModelState.IsValid)
            {
                PlantContext plantContext = new PlantContext();
                plantContext.AddPlant(plant);

                return RedirectToAction("Index");
            }
            return View();
        }
예제 #2
0
 //
 // GET: /Plant/
 public ActionResult Index()
 {
     PlantContext plantContext = new PlantContext();
     List<Plant> plants = plantContext.plants.ToList();
     return View(plants);
 }
예제 #3
0
 public ActionResult Details(int id)
 {
     PlantContext plantContext = new PlantContext();
     Plant plant = plantContext.plants.Single(x => x.Id == id);
     return View(plant);
 }