public IActionResult OnGet() { ViewData["DonorID"] = new SelectList(_context.Set <Donor>(), "ID", "DonorName"); var dog = new Dog(); dog.DogBreeds = new List <DogBreed>(); PopulateAssignedBredData(_context, dog); return(Page()); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } Dog = await _context.Dog .Include(b => b.Donor) .Include(b => b.DogBreeds).ThenInclude(b => b.Breed) .AsNoTracking() .FirstOrDefaultAsync(m => m.ID == id); if (Dog == null) { return(NotFound()); } PopulateAssignedBredData(_context, Dog); ViewData["DonorID"] = new SelectList(_context.Set <Donor>(), "ID", "DonorName"); return(Page()); }