public static void Merge(this List <BookStihos> list, BookStihos stihos) { var foundStihos = list.FirstOrDefault(c => c.StihosNumber == stihos.StihosNumber); if (foundStihos == null) { //просто добавляем стих в коллекцию list.Add(stihos); } else { //добавляем или обновляем локализованные значения foreach (var lang in stihos.Languages) { if (foundStihos.ContainsLanguage(lang)) { foundStihos[lang] = stihos[lang]; } else { foundStihos.AddElement(lang, stihos[lang]); } } } }
private BookStihos CreateStihos(int?number, string text) { var stihos = new BookStihos() { StihosNumber = number }; stihos.AddElement(Language, text); return(stihos); }
public static void AppendStihos(this PsalmLink psalmLink, BookStihos stihos) { if (psalmLink.StartStihos == null) { psalmLink.StartStihos = stihos.StihosNumber; psalmLink.EndStihos = stihos.StihosNumber; } else { psalmLink.EndStihos = stihos.StihosNumber; } }
public static void Merge(this List <BookStihos> list, BookStihos stihos) { var foundStihos = list.FirstOrDefault(c => c.StihosNumber == stihos.StihosNumber); if (foundStihos == null) { //просто добавляем стих в коллекцию list.Add(stihos); } else { foundStihos.Merge(stihos); } }
private BookStihos CreateStihos(int number, string text) { var stihos = new BookStihos() { StihosNumber = number }; stihos.AddOrUpdate(new ItemTextUnit() { Language = Language, Text = text }); return(stihos); }