public IActionResult OnGet() { ViewData["CategoryID"] = new SelectList(_context.Set <Category>(), "ID", "CategoryName"); var product = new Product(); product.ProductSkinTypes = new List <ProductSkinType>(); PopulateAssignedSkinTypeData(_context, product); return(Page()); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } Product = await _context.Product.Include(b => b.Category).Include(b => b.ProductSkinTypes).ThenInclude(b => b.SkinType).AsNoTracking().FirstOrDefaultAsync(m => m.ID == id); if (Product == null) { return(NotFound()); } PopulateAssignedSkinTypeData(_context, Product); ViewData["CategoryID"] = new SelectList(_context.Set <Category>(), "ID", "CategoryName"); return(Page()); }