Ejemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("GameId,Title,Description,Picture,Developer")] Games games)
        {
            if (id != games.GameId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(games);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!GamesExists(games.GameId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(games));
        }
        public async Task <IActionResult> Edit(int id, [Bind("DeveloperId,Name,Adress")] Developers developers)
        {
            if (id != developers.DeveloperId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(developers);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DevelopersExists(developers.DeveloperId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(developers));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Edit(int id, [Bind("GameDevId,GameId,DeveloperId,ReleaseDate")] GameDev gameDev)
        {
            if (id != gameDev.GameDevId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(gameDev);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!GameDevExists(gameDev.GameDevId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DeveloperId"] = new SelectList(_context.Developers, "DeveloperId", "DeveloperId", gameDev.DeveloperId);
            ViewData["GameId"]      = new SelectList(_context.Games, "GameId", "GameId", gameDev.GameId);
            return(View(gameDev));
        }
        public async Task <IActionResult> Edit(int id, [Bind("GradeId,GradeNumber,GradeText")] Grade grade)
        {
            if (id != grade.GradeId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(grade);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!GradeExists(grade.GradeId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(grade));
        }