/// <summary> /// Gets the Multicode. /// </summary> /// <param name="multicodeParameter">The Multicode parameter request.</param> /// <returns></returns> //public async Task<APIResponse> GetAllMultiCodes(MulticodeParameter multicodeParameter) //{ // try // { // string serializedMulticode; // List<MultiCodeResponse> multicode; // var encodedMulticode = await distributedCache.GetAsync(WalletServiceOperation.GetWalletCacheName); // if (encodedMulticode != null) // { // serializedMulticode = Encoding.UTF8.GetString(encodedMulticode); // multicode = JsonConvert.DeserializeObject<List<MultiCodeResponse>>(serializedMulticode); // } // else // { // var client = httpClientFactory.CreateClient(WalletServiceOperation.serviceName); // UriBuilder url = new UriBuilder(servicesConfig.Wallet + WalletServiceOperation.GetAllMultiCodes()); // url.Query = QueryStringHelper.ConvertToQueryString(multicodeParameter); // var response = await client.GetAsync(url.ToString()); // multicode = JsonConvert.DeserializeObject<List<MultiCodeResponse>>(await response.Content.ReadAsStringAsync()); // serializedMulticode = JsonConvert.SerializeObject(multicode); // encodedMulticode = Encoding.UTF8.GetBytes(serializedMulticode); // var options = new DistributedCacheEntryOptions() // .SetSlidingExpiration(TimeSpan.FromMinutes(1)) // .SetAbsoluteExpiration(DateTime.Now.AddHours(1)); // await distributedCache.SetAsync(WalletServiceOperation.GetWalletCacheName, encodedMulticode, options); // } // return new APIResponse(multicode, HttpStatusCode.OK); // } // catch (Exception ex) // { // logger.Error(ex, "Exception in method 'GetAllMultiCodes()'"); // var exMessage = ex.InnerException != null ? ex.InnerException.Message : ex.Message; // return new APIResponse(exMessage, HttpStatusCode.InternalServerError); // } //} public async Task <APIResponse> GetAllMultiCodes(MulticodeParameter multicodeParameter) { try { var client = httpClientFactory.CreateClient(EventAssistantServiceOperation.serviceName); UriBuilder url = new UriBuilder(servicesConfig.Lead + EventAssistantServiceOperation.GetAllMultiCodes()); url.Query = QueryStringHelper.ConvertToQueryString(multicodeParameter); var response = await client.GetAsync(url.ToString()); if (response.IsSuccessStatusCode) { var multicode = JsonConvert.DeserializeObject <List <MultiCodeResponse> >(await response.Content.ReadAsStringAsync()); return(new APIResponse(multicode, HttpStatusCode.OK)); } return(new APIResponse(response.StatusCode)); } catch (Exception ex) { logger.Error(ex, "Exception in method 'GetAllMultiCodes()'"); var exMessage = ex.InnerException != null ? ex.InnerException.Message : ex.Message; return(new APIResponse(exMessage, HttpStatusCode.InternalServerError)); } }