public IActionResult OnGet() { ViewData["BreedID"] = new SelectList(_context.Set <Breed>(), "ID", "BreedName"); var dog = new Dog(); dog.DogColors = new List <DogColor>(); PopulateAssignedColorData(_context, dog); return(Page()); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } Dog = await _context.Dog .Include(b => b.Breed) .Include(b => b.DogColors).ThenInclude(b => b.Color) .AsNoTracking() .FirstOrDefaultAsync(m => m.ID == id); if (Dog == null) { return(NotFound()); } //apelam PopulateAssignedColorData pentru o obtine informatiile necesare checkbox-urilor folosind clasa AssignedColorData PopulateAssignedColorData(_context, Dog); ViewData["BreedID"] = new SelectList(_context.Set <Breed>(), "ID", "BreedName"); return(Page()); }