public void AddNewspaper(NewspaperViewModel nvm)
        {
            int _id = _newspaperRepository.Create(new Newspaper
            {
                Name = nvm.Name,
                Date = nvm.Date,
            }).Id;
            List <NewspaperAuthor> _newspaperAuthors = nvm.Authors.Select(c => new NewspaperAuthor {
                NewspaperId = _id, AuthorId = (int)c.Id
            }).ToList();

            _newspaperAuthorRepository.AddRange(_newspaperAuthors);
            List <NewspaperPublishingHouse> _newspaperPublishingHouses = nvm.PublishingHouses.Select(c => new NewspaperPublishingHouse {
                NewspaperId = _id, PublishingHouseId = (int)c.Id
            }).ToList();

            _newspaperPublishingHouseRepository.AddRange(_newspaperPublishingHouses);
        }
示例#2
0
 public void AddDataReposotiry(Author author, string title, string location, string namePublication, DateTime date)
 {
     _newspaperRepository.Create(author, title, location, namePublication, date);
 }
示例#3
0
 public void Create(Newspaper value)
 {
     _newspaperRepository.Create(value);
 }