public IActionResult OnGet() { ViewData["MaterialID"] = new SelectList(_context.Set <Material>(), "ID", "MaterialType"); var jewelry = new Jewelry(); jewelry.JewelryCategories = new List <JewelryCategory>(); PopulateAssignedCategoryData(_context, jewelry); return(Page()); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } Jewelry = await _context.Jewelry .Include(b => b.Material) .Include(b => b.JewelryCategories).ThenInclude(b => b.Category) .AsNoTracking() .FirstOrDefaultAsync(m => m.ID == id); if (Jewelry == null) { return(NotFound()); } PopulateAssignedCategoryData(_context, Jewelry); ViewData["MaterialID"] = new SelectList(_context.Set <Material>(), "ID", "MaterialType"); return(Page()); }