public IMarket GetCurrentMarket() { var marketCookie = _cookieRepository.Get <MarketCookie>(MarketCookie.CookieName); if (marketCookie != null) { var market = _marketService.GetMarket(marketCookie.MarketId); if (market != null) { return(market); } } return(_marketService.GetAllMarkets().FirstOrDefault()); }
public Currency GetCurrentCurrency() { var currentMaket = _currentMarket.GetCurrentMarket(); var currencyCookie = _cookieRepository.Get <CurrencyCookie>(CurrencyCookie.CookieName); if (currencyCookie == null) { return(currentMaket.DefaultCurrency); } var currency = currentMaket.Currencies.FirstOrDefault(x => x.CurrencyCode == currencyCookie.CurrencytId); if (currency != null) { return(currency); } return(currentMaket.DefaultCurrency); }