public async Task <IActionResult> Edit(int id, [Bind("IdCategoria,NombreCategoria,Status,Observaciones")] Categorias categorias) { if (id != categorias.IdCategoria) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(categorias); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CategoriasExists(categorias.IdCategoria)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["Status"] = new SelectList(_context.Status, "status", "DescripcionStatus", categorias.Status); return(View(categorias)); }
public async Task <IActionResult> Edit(int id, [Bind("IdAlmacen,IdIngrediente,Cantidad,FechaCaducidad,Status,Observaciones")] Almacen almacen) { if (id != almacen.IdAlmacen) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(almacen); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AlmacenExists(almacen.IdAlmacen)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["IdIngrediente"] = new SelectList(_context.Ingredientes, "IdIngrediente", "NombreIngrediente", almacen.IdIngrediente); ViewData["Status"] = new SelectList(_context.Status, "status", "DescripcionStatus", almacen.Status); return(View(almacen)); }