Skip to content

Commit

Permalink
nopSolutions#1897 Refactoring of CurrencyModel factory in the admin area
Browse files Browse the repository at this point in the history
  • Loading branch information
skoshelev committed Apr 5, 2018
1 parent 7b2d09b commit d37d8a1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public CurrencyModelFactory(CurrencySettings currencySettings,
/// </summary>
/// <param name="model">Currency exchange rate provider model</param>
/// <param name="prepareExchangeRates">Whether to prepare exchange rate models</param>
protected virtual void PrepareExchangeRateProviderModel(CurrencyExchangeRateProviderModel model, bool liveRates)
protected virtual void PrepareExchangeRateProviderModel(CurrencyExchangeRateProviderModel model, bool prepareExchangeRates)
{
if (model == null)
throw new ArgumentNullException(nameof(model));
Expand All @@ -74,7 +74,7 @@ protected virtual void PrepareExchangeRateProviderModel(CurrencyExchangeRateProv
}).ToList();

//prepare exchange rates
if (liveRates)
if (prepareExchangeRates)
PrepareExchangeRateModels(model.ExchangeRates);
}

Expand Down Expand Up @@ -114,22 +114,22 @@ protected virtual void PrepareExchangeRateModels(IList<CurrencyExchangeRateModel
/// <summary>
/// Prepare currency search model
/// </summary>
/// <param name="model">Currency search model</param>
/// <param name="searchModel">Currency search model</param>
/// <param name="prepareExchangeRates">Whether to prepare exchange rate models</param>
/// <returns>Currency search model</returns>
public virtual CurrencySearchModel PrepareCurrencySearchModel(CurrencySearchModel model, bool prepareExchangeRates = false)
public virtual CurrencySearchModel PrepareCurrencySearchModel(CurrencySearchModel searchModel, bool prepareExchangeRates = false)
{
if (model == null)
throw new ArgumentNullException(nameof(model));
if (searchModel == null)
throw new ArgumentNullException(nameof(searchModel));

//prepare exchange rate provider model
PrepareExchangeRateProviderModel(model.ExchangeRateProviderModel, prepareExchangeRates);
PrepareExchangeRateProviderModel(searchModel.ExchangeRateProviderModel, prepareExchangeRates);

//prepare page parameters
model.SetGridPageSize();
model.PageSize = 1000;
searchModel.SetGridPageSize();
searchModel.PageSize = 1000;

return model;
return searchModel;
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ public partial interface ICurrencyModelFactory
/// <summary>
/// Prepare currency search model
/// </summary>
/// <param name="model">Currency search model</param>
/// <param name="searchModel">Currency search model</param>
/// <param name="prepareExchangeRates">Whether to prepare exchange rate models</param>
/// <returns>Currency search model</returns>
CurrencySearchModel PrepareCurrencySearchModel(CurrencySearchModel model, bool prepareExchangeRates = false);
CurrencySearchModel PrepareCurrencySearchModel(CurrencySearchModel searchModel, bool prepareExchangeRates = false);

/// <summary>
/// Prepare paged currency list model
Expand Down

0 comments on commit d37d8a1

Please sign in to comment.