/// <summary> /// Return the list of PaymentMethods /// </summary> /// <returns>PaymentMethodList</returns> public async Task <IActionResult> GetPaymentMethod() { BaseResult <List <PaymentMethodViewModel> > paymentMethodResultFromCache = new BaseResult <List <PaymentMethodViewModel> > { Result = RedisCacheHelper.Instance.Get <List <PaymentMethodViewModel> >(Constants.CacheKeys.PaymentMethodList) }; if (paymentMethodResultFromCache.Result == null || paymentMethodResultFromCache.Result.Count == 0) { BaseResult <List <PaymentMethod> > paymentMethodResult = await iPayment.GetPaymentMethod().ConfigureAwait(false); if (paymentMethodResult.IsError && paymentMethodResult.ExceptionMessage != null) { return(new StatusCodeResult(500)); } else if (paymentMethodResult.Result == null || paymentMethodResult.Result.Count == 0) { return(NoContent()); //204 } else { var result = PaymentDataResponseMapper.MapPaymentMethod(paymentMethodResult); RedisCacheHelper.Instance.Set <List <PaymentMethodViewModel> >(Constants.CacheKeys.PaymentMethodList, result.Result); return(Ok(result)); //200 } } return(Ok(paymentMethodResultFromCache)); //200 }
/// <summary> /// Return the list of TaxApplicability /// </summary> /// <returns>TaxApplicabilityList</returns> public async Task <IActionResult> GetTaxApplicability() { BaseResult <List <TaxApplicabilityViewModel> > taxApplicabilityResultFromCache = new BaseResult <List <TaxApplicabilityViewModel> >() { Result = RedisCacheHelper.Instance.Get <List <TaxApplicabilityViewModel> >(Constants.CacheKeys.TaxApplicabilityList) }; if (taxApplicabilityResultFromCache.Result == null || taxApplicabilityResultFromCache.Result.Count == 0) { BaseResult <List <TaxApplicability> > taxApplicabilityResult = await iPayment.GetTaxApplicability().ConfigureAwait(false); if (taxApplicabilityResult.IsError && taxApplicabilityResult.ExceptionMessage != null) { return(new StatusCodeResult(500)); } else if (taxApplicabilityResult.Result == null || taxApplicabilityResult.Result.Count == 0) { return(NoContent()); //204 } else { var result = PaymentDataResponseMapper.MapTaxApplicability(taxApplicabilityResult); RedisCacheHelper.Instance.Set <List <TaxApplicabilityViewModel> >(Constants.CacheKeys.TaxApplicabilityList, result.Result); return(Ok(result)); //200 } } return(Ok(taxApplicabilityResultFromCache)); //200 }
public async Task <IActionResult> GetCurrencyByHotelId([FromBody] int hotelId) { BaseResult <List <Currency> > currencyResult = new BaseResult <List <Currency> >(); if (hotelId <= default(int)) { currencyResult.IsError = true; currencyResult.Message = "Invalid Hotel Id"; return(BadRequest(currencyResult)); } currencyResult = await iPayment.GetCurrencyByHotelId(hotelId).ConfigureAwait(false); if (currencyResult.IsError && currencyResult.ExceptionMessage != null) { return(new StatusCodeResult(500)); } else if (currencyResult.Result == null || currencyResult.Result.Count == 0) { return(NoContent()); //204 } var result = PaymentDataResponseMapper.MapCurrency(currencyResult); return(Ok(result)); //200 }