public async Task <IActionResult> Create([Bind("id,Title,ReleaseDate,Genre,Price,locationID")] Game game) { if (ModelState.IsValid) { _context.Add(game); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(game)); }
public async Task <IActionResult> Create([Bind("locationID,City")] Location location) { if (ModelState.IsValid) { _context.Add(location); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(location)); }
public async Task <IActionResult> Create([Bind("Id,Name,ReleaseDate,Genre,Rating")] Game game) { game.Rating = _context.Rating.Where(r => r.Rating == game.Rating.Rating).FirstOrDefault(); if (ModelState.IsValid) { _context.Add(game); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(game)); }