/// <summary> /// Return the hotel chains /// </summary> /// <returns></returns> public async Task <IActionResult> GetHotelChains() { BaseResult <List <HotelChainViewModel> > hotelChainResultFromCache = new BaseResult <List <HotelChainViewModel> > { Result = RedisCacheHelper.Instance.Get <List <HotelChainViewModel> >(Constants.CacheKeys.HotelChainList) }; if (hotelChainResultFromCache.Result == null || hotelChainResultFromCache.Result.Count == 0) { BaseResult <List <HotelChain> > hotelChainResult = await iMasterData.GetHotelChains().ConfigureAwait(false); if (hotelChainResult.IsError && hotelChainResult.ExceptionMessage != null) { return(new StatusCodeResult(500)); } else if (hotelChainResult.Result == null || hotelChainResult.Result.Count == 0) { return(NoContent()); //204 } else { var hotelChainResultAll = DbMapperMasterdata.MapHotelChains(hotelChainResult); RedisCacheHelper.Instance.Set <List <HotelChainViewModel> >(Constants.CacheKeys.HotelChainList, hotelChainResultAll.Result); return(Ok(hotelChainResultAll)); //200 } } return(Ok(hotelChainResultFromCache)); //200 }