public async Task <WebsiteInfo> GetWebsiteInfo(int websiteId) { var website = await _repository .Query() .Include(_ => _.Layout) .Include(_ => _.DefaultLanguage) .Include(_ => _.Options) .Include(_ => _.DefaultCurrency) .FirstOrDefaultAsync(_ => _.Id == websiteId); if (website == null) { return(null); } var baseCurrency = await _currencyRepository.GetBaseCurrencyAsync(); var result = new WebsiteInfo { Title = website.Title, DefaultLangId = website.DefaultLangId, DefaultLangKey = website.DefaultLanguage.LangKey, Id = website.Id, LayoutName = website.Layout.Name, Name = website.Name, OwnerId = website.OwnerId, Description = website.Description, Keywords = website.Keywords, CurrencyInfo = new WebsiteCurrencyInfo { BaseCurrencySign = baseCurrency.Sign, BaseCurrencyTitle = baseCurrency.Title }, DefaultShippingId = website.DefaultShippingId }; if (website.DefaultCurrency != null) { result.CurrencyInfo.DefaultCurrencySign = website.DefaultCurrency.Sign; result.CurrencyInfo.DefaultCurrencyTitle = website.DefaultCurrency.Title; result.CurrencyInfo.Rate = website.DefaultCurrency.Rate; } var websitePhone = website.Options .FirstOrDefault(_ => _.Key.ToLower() == "website.phone"); var websiteEmail = website.Options .FirstOrDefault(_ => _.Key.ToLower() == "website.email"); if (websitePhone != null) { result.ContactPhone = websitePhone.Value; } if (websiteEmail != null) { result.ContactEmail = websiteEmail.Value; } return(await Task.FromResult(result)); }