示例#1
0
 static public void InsertarCarritoItem(CarritoItem objCarritoItem)
 {
     try
     {
         using (var contextoEntidades = new EZPCEntidades())
         {
             contextoEntidades.Crear_Carrito(objCarritoItem.id_usuario, objCarritoItem.id_producto, objCarritoItem.cantidad);
             contextoEntidades.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
示例#2
0
 public static void ModificarCarrito(CarritoItem carritoItem)
 {
     try
     {
         CarritoItem item = new CarritoItem()
         {
             id = carritoItem.id
         };
         using (var contextoEntidades = new EZPCEntidades())
         {
             contextoEntidades.CarritoItems.Attach(item);
             item.cantidad = carritoItem.cantidad;
             contextoEntidades.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
示例#3
0
 static public void EliminarCarritoItem(CarritoItem carritoItem)
 {
     try
     {
         CarritoItem item = new CarritoItem()
         {
             id = carritoItem.id
         };
         using (var contextoBanco = new EZPCEntidades())
         {
             contextoBanco.CarritoItems.Attach(item);
             contextoBanco.CarritoItems.Remove(item);
             contextoBanco.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }