Exemple #1
0
        /// <summary>
        /// Gets the products by search type and return the list of product responses.
        /// </summary>
        /// <param name="searchValue">The product identifier.</param>
        /// <param name="searchType"></param>
        /// <returns></returns>
        public async Task <ServiceResponse <List <ProductReponse> > > GetProduct(string searchValue, SearchType searchType)
        {
            object product;

            switch (searchType)
            {
            case SearchType.Id:
                product = new { id = searchValue };
                break;

            case SearchType.Name:
                product = new { name = searchValue };
                break;

            default:
                throw new ArgumentException("Invalid Search Type specified.");
            }

            // Post
            return(await _networkClient.PostAsync <List <ProductReponse> >(_webUrlBase, product));
        }