public async Task <IActionResult> Create([Bind("DeveloperId,Name,StreetAddress,City,Telephone")] Developer developer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(developer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(developer));
        }
Beispiel #2
0
        public async Task <IActionResult> Create([Bind("GenreId,Name,Description")] Genre genre)
        {
            if (ModelState.IsValid)
            {
                _context.Add(genre);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(genre));
        }
        public async Task <IActionResult> Create([Bind("Id,Tite,ReleaseDate,Price,Description,InStockAmount")] Game game)
        {
            if (ModelState.IsValid)
            {
                _context.Add(game);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(game));
        }
        public async Task <IActionResult> Create([Bind("Id,Name,Description,MinimumRequirements,Price,DeveloperId,GenreId")] Game game)
        {
            if (ModelState.IsValid)
            {
                _context.Add(game);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DeveloperId"] = new SelectList(_context.Set <Developer>(), "DeveloperId", "DeveloperId", game.DeveloperId);
            ViewData["GenreId"]     = new SelectList(_context.Set <Genre>(), "GenreId", "Description", game.GenreId);
            return(View(game));
        }