/// <summary> /// Gets the utility. /// </summary> /// <param name="utilityId">The utility identifier.</param> /// <returns></returns> public async Task <APIResponse> GetUtility(int utilityId) { try { var client = httpClientFactory.CreateClient(VendorServiceOperation.serviceName); var response = await client.GetAsync(servicesConfig.Vendor + VendorServiceOperation.GetutilityById(utilityId)); if (response.IsSuccessStatusCode) { var multicode = JsonConvert.DeserializeObject <List <UtilityResponse> >(await response.Content.ReadAsStringAsync()); return(new APIResponse(multicode, HttpStatusCode.OK)); } return(new APIResponse(response.StatusCode)); } catch (Exception ex) { logger.Error(ex, "Exception in method 'GetMultiDetailsById()'"); var exMessage = ex.InnerException != null ? ex.InnerException.Message : ex.Message; return(new APIResponse(exMessage, HttpStatusCode.InternalServerError)); } }