Beispiel #1
0
        public static async Task <ProductResult> FindProductByCode(string code)
        {
            if (code == null)
            {
                return new ProductResult {
                           Success = false, Error = "Code was not given"
                }
            }
            ;

            var product = await source.FindProductByCode(code);

            if (product != null)
            {
                return new ProductResult {
                           Success = true, Gtin = code, Name = product.Name, Quantity = product.Quantity, Unit = product.Unit
                }
            }
            ;

            return(new ProductResult {
                Success = false, Error = "Product was not found"
            });
        }