public async Task <IActionResult> Create([Bind("ID,Name")] HardinessZone hardinessZone) { if (ModelState.IsValid) { _context.Add(hardinessZone); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(hardinessZone)); }
public async Task <IActionResult> Create([Bind("ID,HardinessZoneID,Name")] Plant plant) { if (ModelState.IsValid) { _context.Add(plant); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["HardinessZoneID"] = new SelectList(_context.HardinessZone, "ID", "Name", plant.HardinessZoneID); return(View(plant)); }
public async Task <IActionResult> Create([Bind("ID,PlantID,PlantTypeID")] PlantPlantType plantPlantType) { if (ModelState.IsValid) { _context.Add(plantPlantType); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["PlantID"] = new SelectList(_context.Plant, "ID", "Name", plantPlantType.PlantID); ViewData["PlantTypeID"] = new SelectList(_context.PlantType, "ID", "Name", plantPlantType.PlantTypeID); return(View(plantPlantType)); }