public ActionResult Edit([Bind(Include = "Id,CarritoId,ObrasId,Price,Quantity,CreatedOn,CreatedBy,ChangedOn,ChangedBy")] CarritoItem carritoItem) { if (ModelState.IsValid) { db.Entry(carritoItem).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CarritoId = new SelectList(db.Carrito, "Id", "Cookie", carritoItem.ProductId); return(View(carritoItem)); }
public ActionResult Edit(Product product, HttpPostedFileBase file) { if (ModelState.IsValid) { if (file.ContentLength > 0) { string _fileName = Path.GetFileName(file.FileName); string _path = Path.Combine(Server.MapPath("~/Content/products"), _fileName); file.SaveAs(_path); product.Image = _fileName; } this.CheckAuditPattern(product, false); db.Entry(product).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ArtistId = new SelectList(db.Artist, "Id", "FirstName", product.ArtistId); return(View(product)); }