Ejemplo n.º 1
0
        public bool UpdateProduct(Product product, ref string message)
        {
            var result = true;

            if (product.UnitPrice <= 0)
            {
                message = "Price cannot be <= 0";
                result = false;
            }
            else if (string.IsNullOrEmpty(product.ProductName))
            {
                message = "Product name cannot be empty";
                result = false;
            }
            else if (string.IsNullOrEmpty(product.QuantityPerUnit))
            {
                message = "Quantity cannot be empty";
                result = false;
            }
            else
            {
                message = "Product updated successfully";
                result = true;
            }
            return result;
        }
Ejemplo n.º 2
0
 public Product GetProduct(int id)
 {
     var product = new Product
     {
         ProductId = id,
         ProductName = "fake product name from service layer",
         UnitPrice = 10.0m,
         QuantityPerUnit = "fake QPU"
     };
     return product;
 }