コード例 #1
0
 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 });
     }
 }
コード例 #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 });
     }
 }
コード例 #3
0
 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;
     }
 }
コード例 #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;
     }
 }
コード例 #5
0
 public HomeController()
 {
     DatabaseContext context = new DatabaseContext();
     this.productoDAO = new ProductoDAO(context);
 }
コード例 #6
0
 public ProductoDAO(DatabaseContext context)
 {
     this.context = context;
 }