public async Task <IActionResult> Edit(int id, [Bind("ProdCarritoID,cantidadProducto,productoID")] ProdCarrito prodCarrito) { if (id != prodCarrito.ProdCarritoID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(prodCarrito); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProdCarritoExists(prodCarrito.ProdCarritoID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["productoID"] = new SelectList(_context.Producto, "ProductoID", "Codigo", prodCarrito.productoID); return(View(prodCarrito)); }
public async Task <IActionResult> Create([Bind("ProdCarritoID,cantidadProducto,productoID")] ProdCarrito prodCarrito) { if (ModelState.IsValid) { _context.Add(prodCarrito); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["productoID"] = new SelectList(_context.Producto, "ProductoID", "Codigo", prodCarrito.productoID); return(View(prodCarrito)); }
public ActionResult seleccionaProducto(int id) { ProdCarrito objP = ListProdCarrito().Where(p => p.codigo == id).FirstOrDefault(); return(View(objP)); }