public async Task <IActionResult> Edit(int id, [Bind("Id,Title,GenreId,Price,Available,ManufacurerId")] BoardGamesList boardGamesList) { if (id != boardGamesList.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(boardGamesList); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BoardGamesListExists(boardGamesList.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["GenreId"] = new SelectList(_context.BoardGameGenre, "Id", "Name"); ViewData["ManufacturerId"] = new SelectList(_context.Manufacturers, "Id", "Name"); return(View(boardGamesList)); }
public async Task <IActionResult> Create([Bind("Id,Title,GenreId,Price,Available,ManufacurerId")] BoardGamesList boardGamesList) { if (ModelState.IsValid) { _context.Add(boardGamesList); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["GenreId"] = new SelectList(_context.BoardGameGenre, "Id", "Name"); ViewData["ManufacturerId"] = new SelectList(_context.Manufacturers, "Id", "Name"); return(View(boardGamesList)); }