public async Task <IActionResult> Create([Bind("SpeciesId,Species1,Area,IsEndangered")] Species species) { if (ModelState.IsValid) { _context.Add(species); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(species)); }
public async Task <IActionResult> Create([Bind("PetId,SpeciesId,Name,Gender,Color")] Pet pet) { if (ModelState.IsValid) { _context.Add(pet); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["SpeciesId"] = new SelectList(_context.Species, "SpeciesId", "Species1", pet.SpeciesId); return(View(pet)); }