public ExportContentModel ParseContent(ExportContentModel model) { var newContent = model.Content.ToDictionary(entry => entry.Key, entry => entry.Value); foreach (var property in model.Content) { if (property.Value == null) continue; var v = property.Value.ToString().Trim().Replace(" ", ""); var items = v.Split(','); var allInts = true; foreach (var item in items) { var intValue = -1; allInts = int.TryParse(item, out intValue); allInts = allInts && intValue > 0; } allInts = allInts && items.Length > 1; if (!allInts) continue; var newValue = AllPaths(items.Select(int.Parse)); newContent.Remove(property.Key); newContent.Add(property.Key, newValue); } model.Content = newContent; return model; }
public ExportContentModel ParseContent(ExportContentModel model) { var newContent = model.Content.ToDictionary(entry => entry.Key, entry => entry.Value); foreach (var property in model.Content) { if (property.Value == null) continue; int x = -1; if (int.TryParse(property.Value.ToString(), out x)) { var content = _allContent.FirstOrDefault(v => v.Content.Id == x); if (content != null) { newContent.Remove(property.Key); newContent.Add(property.Key, content.Path); } } } model.Content = newContent; return model; }
public ExportContentModel ParseContent(ExportContentModel model) { var newContent = model.Content.ToDictionary(entry => entry.Key, entry => entry.Value); foreach (var property in model.Content) { if (property.Value != null) continue; newContent.Remove(property.Key); newContent.Add(property.Key, string.Empty); } model.Content = newContent; return model; }