Ejemplo n.º 1
0
        public async Task <GenericGetModelResponse <ProductScheduleModel> > GetScheduleAsync(int productId, DateTime startDate)
        {
            var response = new GenericGetModelResponse <ProductScheduleModel>();
            var httpTask = _httpClient.GetAsync($"schedule/{productId}/{startDate.ToString("yyyy-MM-dd")}");

            var apiResult = await SendApiRequest <ICollection <ProductScheduleModel> >(response, httpTask);

            if (response.IsError())
            {
                return(response);
            }

            response.Models.AddRange(apiResult);

            return(response);
        }
Ejemplo n.º 2
0
        public async Task <GenericGetModelResponse <SearchResponseModel> > SearchAsync(string keyword)
        {
            var response = new GenericGetModelResponse <SearchResponseModel>();
            var httpTask = _httpClient.GetAsync($"search?q={keyword}&lat=-24.9922916&lng=115.224928");

            var apiResult = await SendApiRequest <ICollection <SearchResponseModel> >(response, httpTask);

            if (response.IsError())
            {
                return(response);
            }

            response.Models.AddRange(apiResult);

            return(response);
        }