Exemplo n.º 1
0
 public static Product ReturnItem(Product product)
 {
     try {
         SqlConnection connect         = RetaloDB.GetConnection();
         string        selectStatement =
             "Select *"
             + "FROM Products"
             + " Where ProdID = @id";
         SqlCommand selectCommand = new SqlCommand(selectStatement, connect);
         selectCommand.Parameters.AddWithValue("@id", product.ID);
         Product product2 = ProductOperations.ReturnProduct(selectCommand, connect);
         return(product2);
     }
     catch (Exception ex) {
         throw ex;
     }
 }
Exemplo n.º 2
0
        public static Boolean AddorUpdateItem(Product product)
        {
            try
            {
                if (ReturnItem(product) == null)
                {
                    return(ProductOperations.AddProduct(product));
                }
                else
                {
                    return(ProductOperations.UpdateProduct(product.ID, product));
                }
            }
            catch (Exception ex)
            {
                return(false);

                throw ex;
            }
        }