public ActionResult EditarP(ProductosViewModel model) { try { if (ModelState.IsValid) { using (TredaEntities db = new TredaEntities()) { var oTabla = db.Productos.Find(model.SKU); oTabla.Nombre = model.Nombre; oTabla.Descripcion = model.Descripcion; oTabla.Valor = model.Valor; oTabla.Tienda = model.Tienda; oTabla.Imagen = model.Imagen; db.Entry(oTabla).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); } return(Redirect("~/Tiendas/")); } return(View(model)); } catch (Exception ex) { throw new Exception(ex.Message); } }
public ActionResult EditarT(TiendasViewModel model) { try { if (ModelState.IsValid) { using (TredaEntities db = new TredaEntities()) { var oTabla = db.Tiendas.Find(model.ID); oTabla.Nombre = model.Nombre; oTabla.Fecha_de_Apertura = model.Fecha_de_Apertura; db.Entry(oTabla).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); } return(Redirect("~/Tiendas/")); } return(View(model)); } catch (Exception ex) { throw new Exception(ex.Message); } }