Exemplo n.º 1
0
        public async Task <IActionResult> Edit(int IdColor, [Bind("IdColor,Nombre")] ColorProducto colorProducto)
        {
            if (IdColor != colorProducto.IdColor)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(colorProducto);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ColorProductoExists(colorProducto.IdColor))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(colorProducto));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> DeleteConfirmed(int IdColor)
        {
            ColorProducto model = await _context.ColorProducto.FindAsync(IdColor);

            _context.ColorProducto.Remove(model);
            await _context.SaveChangesAsync();

            return(RedirectToAction(nameof(Index)));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Create([Bind("Nombre")] ColorProducto colorProducto)
        {
            if (ModelState.IsValid)
            {
                _context.Add(colorProducto);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(colorProducto));
        }
Exemplo n.º 4
0
        // GET: ColorProducto/Edit
        public async Task <IActionResult> Edit(int?IdColor)
        {
            if (IdColor == null)
            {
                return(NotFound());
            }

            ColorProducto model = await _context.ColorProducto.FindAsync(IdColor);

            if (model == null)
            {
                return(NotFound());
            }
            return(View(model));
        }
Exemplo n.º 5
0
        // GET: ColorProducto/Details/
        public async Task <IActionResult> Details(int?IdColor)
        {
            if (IdColor == null)
            {
                return(NotFound());
            }

            ColorProducto model = await _context.ColorProducto
                                  .FirstOrDefaultAsync(m => m.IdColor == IdColor);

            if (model == null)
            {
                return(NotFound());
            }

            return(View(model));
        }