public IList <DynamicText> GetAllDynamicText(string name, string scope) { using (var dbContext = m_dbContextFunc.Invoke()) { var dictionaryScope = GetDictionaryScope(dbContext, scope); var staticTextDao = new StaticTextDao(dbContext.StaticText); var values = staticTextDao.FindByNameAndScope(name, dictionaryScope, dbContext.CultureHierarchy); var resultList = new List <DynamicText>(); foreach (var value in values) { var dynamicText = new DynamicText { FallBack = false, Culture = value.Culture.Name, DictionaryScope = value.DictionaryScope.Name, Format = value.Format, ModificationTime = value.ModificationTime, ModificationUser = value.ModificationUser, Name = value.Name, Text = value.Text }; resultList.Add(dynamicText); } return(resultList); } }
public void DeleteAllDynamicText(string name, string scope) { using (var dbContext = m_dbContextFunc.Invoke()) { var dao = new StaticTextDao(dbContext.StaticText); var dictionaryScope = GetDictionaryScope(dbContext, scope); var staticTextList = dao.FindByNameAndScope(name, dictionaryScope, dbContext.CultureHierarchy); if (staticTextList.Count == 0) { return; } foreach (var staticText in staticTextList) { dao.Delete(staticText); } dbContext.SaveChanges(); } }