public async Task <IActionResult> Edit(int id, [Bind("Id,IdProgramacion,IdCentroEducativo,IdProducto,Cantidad")] NotaRemision notaRemision) { if (id != notaRemision.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(notaRemision); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!NotaRemisionExists(notaRemision.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index), new { IdProgramacion = notaRemision.IdProgramacion })); } ViewData["IdCentroEducativo"] = new SelectList(_context.CentroEducativo.Where(x => x.Id == notaRemision.IdCentroEducativo), "Id", "Nombre", notaRemision.IdCentroEducativo); ViewData["IdProducto"] = new SelectList(_context.Producto.Where(x => x.Id == notaRemision.IdProducto), "Id", "Nombre", notaRemision.IdProducto); ViewData["IdProgramacions"] = new SelectList(_context.Programacion.Where(x => x.Id == notaRemision.IdProgramacion), "Id", "Fecha", notaRemision.IdProgramacion); ViewBag.idprogramacion = notaRemision.IdProgramacion; return(View(notaRemision)); }
public async Task <IActionResult> Create([Bind("Id,IdProgramacion,IdCentroEducativo,IdProducto,Cantidad")] NotaRemision notaRemision) { if (ModelState.IsValid) { _context.Add(notaRemision); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["IdCentroEducativo"] = new SelectList(_context.CentroEducativo, "Id", "Id", notaRemision.IdCentroEducativo); ViewData["IdProducto"] = new SelectList(_context.Producto, "Id", "Nombre", notaRemision.IdProducto); ViewData["IdProgramacion"] = new SelectList(_context.Programacion, "Id", "Estado", notaRemision.IdProgramacion); return(View(notaRemision)); }