public async Task <IActionResult> Create([Bind("AnimalId,AnimalName,AnimalAge,AnimalGender,AnimalBreed,AnimalTemporment,AnimalDescription")] Animals animals) { if (ModelState.IsValid) { _context.Add(animals); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(animals)); }
public async Task <IActionResult> Create([Bind("VolunteerId,FirstName,LastName,Position,Age,StartDate,AnimalId")] Volunteers volunteers) { if (ModelState.IsValid) { _context.Add(volunteers); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["AnimalId"] = new SelectList(_context.Animals, "AnimalId", "AnimalId", volunteers.AnimalId); return(View(volunteers)); }