public void Insert() { using (var uow = _unitOfWorkFactory.Create()) { var defaultLanguage = DefaultLanguage; uow.GetRepository.Add(defaultLanguage); foreach (var item in GetResourceString()) { var localeResourceKey = new LocaleResourceKey { Id = Guid.NewGuid(), Key = item.Key }; uow.GetRepository.Add(localeResourceKey); var localeResource = new LocaleResource { Id = Guid.NewGuid(), Value = item.Value, LanguageId = defaultLanguage.Id, LocaleResourceKeyId = localeResourceKey.Id }; uow.GetRepository.Add(localeResource); } uow.Commit(); } }
private LocaleResource CreateLocaleResource() { var localeResourceKeyId = Guid.NewGuid(); var result = new LocaleResource { Id = Guid.NewGuid(), LocaleResourceKey = new LocaleResourceKey { Id = localeResourceKeyId }, LocaleResourceKeyId = localeResourceKeyId }; return result; }
public LocaleResourcesUpdateViewModel(LocaleResource localeResource) { LanguageId = localeResource.LanguageId.Value; LocaleResourceKey = localeResource.LocaleResourceKey.Key; Value = localeResource.Value; }