public void Edit(Publisher publisher) { _publisherRepository.Edit(publisher); }
private void AddPublisher(Comic comic, IPublisherRepository publisherRepository, string publisherStr) { if (string.IsNullOrEmpty(publisherStr)) return; string[] publishers = publisherStr.Split(','); foreach (string publisher in publishers) { string publisherTrim = publisher.Trim(); Publisher publisherDb = publisherRepository.Find(g => g.PublisherName.Equals(publisherTrim)).FirstOrDefault(); if (publisherDb == null) { publisherDb = new Publisher { PublisherName = publisherTrim, Comics = new List<Comic>() }; publisherDb.Comics.Add(comic); publisherRepository.Add(publisherDb); } else { if (publisherDb.Comics == null) publisherDb.Comics = new List<Comic>(); if (publisherDb.Comics.Any(c => c.ComicUrl.Equals(comic.ComicUrl))) continue; publisherDb.Comics.Add(comic); publisherRepository.Edit(publisherDb); } if (comic.Publishers == null) comic.Publishers = new List<Publisher>(); if (!comic.Publishers.Any(g => g.PublisherName.Equals(publisherTrim))) { comic.Publishers.Add(publisherDb); } publisherRepository.Save(); } }