Пример #1
0
 private void AddCategories(SportCategoriesDTO item, CultureInfo culture)
 {
     lock (_mergeLock)
     {
         foreach (var category in item.Categories)
         {
             try
             {
                 if (Categories.ContainsKey(category.Id))
                 {
                     CategoryCI ci;
                     Categories.TryGetValue(category.Id, out ci);
                     ci?.Merge(new CategoryCI(category, culture, item.Sport.Id), culture);
                 }
                 else
                 {
                     Categories.Add(category.Id, new CategoryCI(category, culture, item.Sport.Id));
                 }
             }
             catch (Exception e)
             {
                 ExecutionLog.Error($"Error saving CategoryDTO for {category.Id} and lang={culture.TwoLetterISOLanguageName}.", e);
             }
         }
     }
 }
Пример #2
0
 private void AddSport(URN id, SportCategoriesDTO item, CultureInfo culture)
 {
     lock (_mergeLock)
     {
         try
         {
             if (Sports.ContainsKey(id))
             {
                 SportCI ci;
                 Sports.TryGetValue(id, out ci);
                 ci?.Merge(new SportCI(new SportDTO(item.Sport.Id.ToString(), item.Sport.Name, item.Categories), _dataRouterManager, culture), culture);
             }
             else
             {
                 Sports.Add(id, new SportCI(new SportDTO(item.Sport.Id.ToString(), item.Sport.Name, item.Categories), _dataRouterManager, culture));
             }
         }
         catch (Exception e)
         {
             ExecutionLog.Error($"Error saving SportEntityDTO for {id} and lang={culture.TwoLetterISOLanguageName}.", e);
         }
     }
 }