/// <summary> /// Return the List of Countries /// </summary> /// <returns></returns> /// public async Task <IActionResult> GetCountries() { BaseResult <List <CountryViewModel> > countryResultFromCache = new BaseResult <List <CountryViewModel> > { Result = RedisCacheHelper.Instance.Get <List <CountryViewModel> >(Constants.CacheKeys.CountryList) }; if (countryResultFromCache.Result == null || countryResultFromCache.Result.Count == 0) { BaseResult <List <Country> > countryResult = await iMasterData.GetCountries().ConfigureAwait(false); if (countryResult.IsError && countryResult.ExceptionMessage != null) { return(new StatusCodeResult(500)); } else if (countryResult.Result == null || countryResult.Result.Count == 0) { return(NoContent()); //204 } else { var countryListVm = DbMapperMasterdata.MapCountry(countryResult, continentResultFromCache); RedisCacheHelper.Instance.Set <List <CountryViewModel> >(Constants.CacheKeys.CountryList, countryListVm.Result); return(Ok(countryListVm)); //200 } } return(Ok(countryResultFromCache)); //200 }