Exemplo n.º 1
0
 public ProductDBO GetProduct(int id)
 {
     var p = new ProductDBO
     {
         ProductId = id,
         ProductName = "fake product from business logic layer",
         UnitPrice = 20.0m,
         QuantityPerUnit = "fake QPU"
     };
     return p;
 }
Exemplo n.º 2
0
        public bool UpdateProduct(ProductDBO product, ref string message)
        {
            var productInDB = GetProduct(product.ProductId);

            if (productInDB == null)
            {
                message = "cannot get product for this ID";
                return false;
            }

            if (product.Discontinued == true && productInDB.UnitsOnOrder > 0)
            {
                message = "cannot discontinue this product";
                return false;
            }
            else
            {
                message = "Product updated successfully";
                return true;
            }
        }