public IActionResult OnGet() { ViewData["StoreID"] = new SelectList(_context.Set <Store>(), "ID", "StoreName"); var flowerBox = new FlowerBox(); flowerBox.FlowerBoxCategories = new List <FlowerBoxCategory>(); PopulateAssignedCategoryData(_context, flowerBox); return(Page()); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } FlowerBox = await _context.FlowerBox.Include(b => b.Store).Include(b => b.FlowerBoxCategories).ThenInclude(b => b.Category).AsNoTracking().FirstOrDefaultAsync(m => m.ID == id); if (FlowerBox == null) { return(NotFound()); } PopulateAssignedCategoryData(_context, FlowerBox); ViewData["StoreID"] = new SelectList(_context.Set <Store>(), "ID", "StoreName"); return(Page()); }