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)); }
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))); }
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)); }
// 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)); }
// 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)); }