public void Actualizar(string pais, decimal costo)
 {
     using (var connection = new DatabaseContext().Database.Connection)
     {
         connection.Open();
         connection.Execute("Update CostoEnvioPais set costo=@costo where pais=@pais", new { costo, pais });
     }
 }
Esempio n. 2
0
 public void DisminuirInventario(int productoId, int cantidad)
 {
     using (var connection = new DatabaseContext().Database.Connection)
     {
         connection.Open();
         connection.Execute("Update Inventario set cantidad=@cantidad where productoId=@productoId", new { productoId, cantidad });
     }
 }
 public decimal Obtener(string pais)
 {
     using (var connection = new DatabaseContext().Database.Connection)
     {
         connection.Open();
         var costo = connection.Query<decimal>("Select costo from CostoEnvioPais where pais=@pais", new { pais }).Single();
         return costo;
     }
 }
Esempio n. 4
0
 public int CantidadInventario(int productoId)
 {
     using (var connection = new DatabaseContext().Database.Connection)
     {
         connection.Open();
         var cantidad=connection.Query<int>("select cantidad from Inventario where productoId=@productoId", new { productoId }).Single();
         return cantidad;
     }
 }
 public HomeController()
 {
     DatabaseContext context = new DatabaseContext();
     this.productoDAO = new ProductoDAO(context);
 }
 public ProductoDAO(DatabaseContext context)
 {
     this.context = context;
 }