Skip to content

Instantly share code, notes, and snippets.

@DmitrySikorsky
Created July 13, 2019 09:40
Show Gist options
  • Save DmitrySikorsky/82663324585a53d2fc5376189b9222c7 to your computer and use it in GitHub Desktop.
Save DmitrySikorsky/82663324585a53d2fc5376189b9222c7 to your computer and use it in GitHub Desktop.
private void CreateLocalizations(PropertyInfo propertyInfo, LocalizationSet localizationSet)
{
ICultureRepository cultureRepository = this.HttpContext.RequestServices.GetService<ICultureRepository>();
ILocalizationRepository localizationRepository = this.HttpContext.RequestServices.GetService<ILocalizationRepository>();
Storage storage = this.HttpContext.RequestServices.GetService<Storage>();
foreach (Culture culture in cultureRepository.GetAll())
{
Localization localization = new Localization();
localization.LocalizationSetId = localizationSet.Id;
localization.CultureCode = culture.Code;
localization.Value = this.Request.Form[propertyInfo.Name + culture.Code];
localizationRepository.Create(localization);
}
storage.SaveChanges();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment