Exemplo n.º 1
0
        public DataTable FilteredOrders(string category)
        {
            ProductDataHandler productdate = new ProductDataHandler();

            FilteredData = productdate.FilterOrders("Products", category);
            return(FilteredData);
        }
Exemplo n.º 2
0
        //Method of reading products accessed from the data access layer
        public DataTable GetProducts()
        {
            ProductDataHandler productdata = new ProductDataHandler();

            dataT = productdata.GetProducts("Products");
            return(dataT);
        }
Exemplo n.º 3
0
        public List <Product> ReadingProducts()
        {
            List <Product> ReadProducts = new List <Product>();
            DataSet        GetClients   = new ProductDataHandler().ReadProducts("Products");

            foreach (DataRow item in GetClients.Tables["Products"].Rows)
            {
                ReadProducts.Add(new Product(item["ProductID"].ToString(), item["CategoryID"].ToString(), item["ProductName"].ToString(), int.Parse(item["AvailableQuantity"].ToString()), Double.Parse(item["Price"].ToString()), item["Description"].ToString(), item["Manufacturer"].ToString(), item["Model"].ToString(), item["SerialNumber"].ToString()));
            }
            return(ReadProducts);
        }
Exemplo n.º 4
0
        public Product Post([FromBody] Product pProduct)
        {
            Product p = pProduct;

            try {
                p = new ProductDataHandler().SaveProduct(pProduct);
            }
            catch (Exception ex)
            {
                return(null);
            }
            return(p);
        }
Exemplo n.º 5
0
        public Product Get(int id)
        {
            Product p = new ProductDataHandler().GetProducts().Where(x => x.ProductId == id).FirstOrDefault();

            return(p == null? new Product(): p);
        }