protected virtual Dil GetLanguageFromUrl() { if (_httpContextAccessor.HttpContext?.Request == null) { return(null); } var path = _httpContextAccessor.HttpContext.Request.Path.Value; if (!path.IsLocalizedUrl(_httpContextAccessor.HttpContext.Request.PathBase, false, out Dil language)) { return(null); } //check language availability if (!_siteMappingService.YetkiVer(language)) { return(null); } return(language); }
public virtual IList <Dil> GetAllLanguages(bool showHidden = false, int siteId = 0, bool loadCacheableCopy = true) { Func <IList <Dil> > loadLanguagesFunc = () => { var query = _languageRepository.Tablo; if (!showHidden) { query = query.Where(l => l.Yayınlandı); } query = query.OrderBy(l => l.GörüntülenmeSırası).ThenBy(l => l.Id); return(query.ToList()); }; IList <Dil> languages; if (loadCacheableCopy) { //cacheable copy var key = string.Format(LANGUAGES_ALL_KEY, showHidden); languages = _cacheManager.Al(key, () => { var result = new List <Dil>(); foreach (var language in loadLanguagesFunc()) { result.Add(new LanguageForCaching(language)); } return(result); }); } else { languages = loadLanguagesFunc(); } //store mapping if (siteId > 0) { languages = languages .Where(l => _siteMappingService.YetkiVer(l, siteId)) .ToList(); } return(languages); }