public async Task <IActionResult> Edit(int IdMaterial, MaterialProducto MaterialProducto) { if (IdMaterial != MaterialProducto.IdMaterial) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(MaterialProducto); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MaterialProductoExists(MaterialProducto.IdMaterial)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(MaterialProducto)); }
public async Task <IActionResult> DeleteConfirmed(int IdMaterial) { MaterialProducto model = await _context.MaterialProducto.FindAsync(IdMaterial); _context.MaterialProducto.Remove(model); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); }
public async Task <IActionResult> Create(MaterialProducto MaterialProducto) { if (ModelState.IsValid) { _context.Add(MaterialProducto); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(MaterialProducto)); }
// GET: MaterialProducto/Edit public async Task <IActionResult> Edit(int?IdMaterial) { if (IdMaterial == null) { return(NotFound()); } MaterialProducto model = await _context.MaterialProducto.FindAsync(IdMaterial); if (model == null) { return(NotFound()); } return(View(model)); }
// GET: MaterialProducto/Details/ public async Task <IActionResult> Details(int?IdMaterial) { if (IdMaterial == null) { return(NotFound()); } MaterialProducto model = await _context.MaterialProducto .FirstOrDefaultAsync(m => m.IdMaterial == IdMaterial); if (model == null) { return(NotFound()); } return(View(model)); }