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());
        }
示例#2
0
        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());
        }