public string EditProduct(Product product)
 {
     try
     {
         DataOperationService dataOperationService = new DataOperationService();
         int    result       = 0;
         string errorMessage = Product.VailidateProductFields(product);
         if (string.IsNullOrEmpty(errorMessage))
         {
             result = dataOperationService.UpdateProductAsync(product).GetAwaiter().GetResult();
         }
         else if (!string.IsNullOrEmpty(errorMessage))
         {
             return(errorMessage);
         }
         else
         {
             result = -1;
         }
         return(result.ToString());
     }
     catch
     {
         throw;
     }
 }
        public string DeleteProduct(int Id)
        {
            try
            {
                DataOperationService dataOperationService = new DataOperationService();
                int result = 0;

                result = dataOperationService.DeleteProductAsync(Id).GetAwaiter().GetResult();
                return(result.ToString());
            }
            catch
            {
                throw;
            }
        }
 public IHttpActionResult GetProducts(int pageSize = 10)
 {
     try
     {
         int pageNo   = 0;
         int IsPaging = 0;
         DataOperationService dataOperationService = new DataOperationService();
         List <Product>       products             = dataOperationService.GetProductsAsync(pageNo, pageSize, IsPaging).GetAwaiter().GetResult();
         return(Ok(products));
     }
     catch
     {
         throw;
     }
 }
 public IHttpActionResult GetProduct(int Id)
 {
     try
     {
         DataOperationService dataOperationService = new DataOperationService();
         Product product = dataOperationService.GetProductAsync(Id).GetAwaiter().GetResult();
         if (product == null)
         {
             return(NotFound());
         }
         return(Ok(product));
     }
     catch
     {
         throw;
     }
 }