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