public static UpdateViewModel GetDefault(SioEnums.EnumTemplateFolder folderType, string specificulture) { string activedTheme = SioService.GetConfig <string>(SioConstants.ConfigurationKeyword.ThemeName, specificulture) ?? SioService.GetConfig <string>(SioConstants.ConfigurationKeyword.DefaultTheme); string folder = CommonHelper.GetFullPath(new string[] { SioConstants.Folder.TemplatesFolder , activedTheme , folderType.ToString() }); var defaulTemplate = SioTemplates.UpdateViewModel.Repository.GetModelListBy( t => t.Theme.Name == activedTheme && t.FolderType == folderType.ToString()).Data?.FirstOrDefault(); return(defaulTemplate ?? new UpdateViewModel(new SioTemplate() { ThemeId = SioService.GetConfig <int>(SioConstants.ConfigurationKeyword.ThemeId, specificulture), ThemeName = SioService.GetConfig <string>(SioConstants.ConfigurationKeyword.ThemeFolder, specificulture), FileName = SioService.GetConfig <string>(SioConstants.ConfigurationKeyword.DefaultTemplate), Extension = SioService.GetConfig <string>(SioConstants.ConfigurationKeyword.TemplateExtension), Content = SioService.GetConfig <string>(SioConstants.ConfigurationKeyword.DefaultTemplateContent), FolderType = folderType.ToString(), FileFolder = folder.ToString() })); }
public static UpdateViewModel GetTemplateByPath(string path, string specificulture, SioEnums.EnumTemplateFolder folderType, SioCmsContext _context = null, IDbContextTransaction _transaction = null) { string templateName = path?.Split('/')[1]; int themeId = SioService.GetConfig <int>(SioConstants.ConfigurationKeyword.ThemeId, specificulture); string themeName = SioService.GetConfig <string>(SioConstants.ConfigurationKeyword.ThemeName, specificulture); var getView = UpdateViewModel.Repository.GetSingleModel(t => t.ThemeId == themeId && t.FolderType == folderType.ToString() && !string.IsNullOrEmpty(templateName) && templateName.Equals($"{t.FileName}{t.Extension}"), _context, _transaction); return(getView.Data ?? GetDefault(folderType, specificulture)); }