Esempio n. 1
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,MarcaId,Modelo,Descripcion,Cantidad,Precio,FechaSalida,Estado,TiendaId")] Consola consola)
        {
            if (id != consola.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(consola);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ConsolaExists(consola.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["MarcaId"]  = new SelectList(_context.Marca, "ID", "Nombre", consola.MarcaId);
            ViewData["TiendaId"] = new SelectList(_context.Tienda, "ID", "Nombre", consola.TiendaId);
            return(View(consola));
        }
Esempio n. 2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,ShortDescription,LongDescription,Image,Price,IsFavourite,Available,CategoryId")] Game game)
        {
            if (id != game.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(game);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!GameExists(game.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CategoryId"] = new SelectList(_context.Category, "Id", "Id", game.CategoryId);
            return(View(game));
        }
        public async Task <IActionResult> Edit(int id, [Bind("GameGenreId,Name")] GameGenre gameGenre)
        {
            if (id != gameGenre.GameGenreId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(gameGenre);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!GameGenreExists(gameGenre.GameGenreId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(gameGenre));
        }
Esempio n. 4
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,Nombre")] Marca marca)
        {
            if (id != marca.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(marca);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MarcaExists(marca.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(marca));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ID,GameImage,Title,Genre,Price,Description,UnitsInStock")] Game game)
        {
            if (id != game.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(game);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!GameExists(game.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(game));
        }
Esempio n. 6
0
        public async Task <IActionResult> Edit(string id, [Bind("ID,CreateDate,EmailAddress")] W_Email w_Email)
        {
            if (id != w_Email.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(w_Email);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!W_EmailExists(w_Email.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(w_Email));
        }
Esempio n. 7
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,CategoryName,Description")] Category category)
        {
            if (id != category.Id)
            {
                return(NotFound());
            }

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