/// <summary>
 /// Ctor: init controller within app environment.
 /// </summary>
 public SmartsController(CountryResolver cres, LangRepo langRepo, SqlDict dict,
                         QueryLogger qlog, IConfiguration config)
 {
     this.cres     = cres;
     this.langRepo = langRepo;
     this.dict     = dict;
     this.qlog     = qlog;
 }
Beispiel #2
0
 /// <summary>
 /// Ctor: Infuse app services.
 /// </summary>
 /// <remarks>
 /// Default null values make controller accessible to <see cref="IndexController"/>.
 /// That way, functionality is limited to serving static pages.
 /// </remarks>
 public DynpageController(PageProvider pageProvider, IConfiguration config, ILoggerFactory loggerFactory,
                          Auth auth, SqlDict dict, CountryResolver cres, QueryLogger qlog, Sphinx sphinx, LangRepo langRepo)
 {
     this.cres         = cres;
     this.pageProvider = pageProvider;
     this.dict         = dict;
     this.sphinx       = sphinx;
     this.qlog         = qlog;
     this.config       = config;
     this.logger       = loggerFactory.CreateLogger("DynpageController");
     this.auth         = auth;
     this.langRepo     = langRepo;
 }
Beispiel #3
0
        public string GetLanguageCultureName(int languageId)
        {
            var languages = LangRepo.Load();

            if (languages == null || languages.Count == 0)
            {
                return(null);
            }
            var langInfo =
                languages.FirstOrDefault(l => l.Id == languageId);

            return(langInfo == null ? String.Empty : langInfo.CultureName);
        }
Beispiel #4
0
        public int?GetLanguageId(string cultureName)
        {
            var languages = LangRepo.Load();

            if (languages == null || languages.Count == 0)
            {
                return(null);
            }
            var langInfo =
                languages.FirstOrDefault(
                    l => String.Equals(l.CultureName, cultureName, StringComparison.OrdinalIgnoreCase));

            return(langInfo == null ? (int?)null : langInfo.Id);
        }
Beispiel #5
0
 public EditController(LangRepo langRepo, SqlDict dict, Auth auth)
 {
     this.langRepo = langRepo;
     this.dict     = dict;
     this.auth     = auth;
 }
 public NewEntryController(LangRepo langRepo, SqlDict dict)
 {
     this.langRepo = langRepo;
     this.dict     = dict;
 }