/// <summary> /// Get product availibility list based on product code /// </summary> /// <param name="productAvailabilityModel"></param> /// <returns></returns> public async Task <string> AvailableProducts(ProductAvailabilityRequest productAvailabilityModel, ViatorSetting setting = null) { var uri = $"service/available/products"; var response = await _httpClient.PostAsync <ProductAvailabilityRequest>(GenerateBaseURL(uri, setting), productAvailabilityModel); if (response.IsSuccessStatusCode) { var result = response.Content.ReadAsStringAsync().Result; if (string.IsNullOrEmpty(result)) { throw new Exception("Viator API - AvailableProducts : Empty response return from server"); } return(result); } else { throw new Exception("Viator API - AvailableProducts: Api error response"); } }
public async Task <ResponseList <ProductAvailabilityResponse> > GetProductAvailabilities(ProductAvailabilityRequest request) { var product = await _uow.Products.FindAsync(new Guid(request.ProductId)); var availabilities = await _productSharedService.GetProductAvailabilities(product); return(new ResponseList <ProductAvailabilityResponse>(ResponseStatus.Ok, _mapService.MapProductAvailablities(availabilities))); }
public async Task <IHttpActionResult> GetProductAvailablities([FromUri] ProductAvailabilityRequest request) { var response = await _productService.GetProductAvailabilities(request); return(new CreateResult(response)); }