public List <NewspaperViewModel> GetNewspapers()
        {
            var a   = _newspaperRepository.GetAll().ToList();
            var res = a.Select(b =>
                               new NewspaperViewModel
            {
                Id      = b.Id,
                Name    = b.Name,
                Date    = b.Date,
                Authors = (from at in _authorRepository.GetAll().ToList()
                           from na in _newspaperAuthorRepository.GetAll().ToList()
                           where na.NewspaperId == b.Id
                           where na.AuthorId == at.Id
                           select new AuthorViewModel {
                    Id = at.Id, FullName = at.Name + " " + at.Surname
                }).ToList(),
                PublishingHouses = (from ph in _publishingHouseRepository.GetAll().ToList()
                                    from bph in _newspaperPublishingHouseRepository.GetAll().ToList()
                                    where bph.NewspaperId == b.Id
                                    where bph.PublishingHouseId == ph.Id
                                    select new PublishingHouseViewModel {
                    Id = ph.Id, Name = ph.Name
                }).ToList()
            }).ToList();

            return(res);
        }
Example #2
0
        public void FillListBoxMain()
        {
            var bookList      = _bookRepository.GetAll();
            var journalList   = _journalRepository.GetAll();
            var newspaperList = _newspaperRepository.GetAll();

            _mainForm.FillListBoxMain(_publications, bookList, journalList, newspaperList);
        }
Example #3
0
        public void FillListBoxMain()
        {
            List <Book>      bookList      = _bookRepository.GetAll();
            List <Journal>   journalList   = _journalRepository.GetAll();
            List <Newspaper> newspaperList = _newspaperRepository.GetAll();

            _mainForm.FillListBoxMain(Publications, bookList, journalList, newspaperList);
        }
Example #4
0
        private void FillListBoxNewspapers()
        {
            _publicationForm.ClearListBoxMain();

            var newspapers = _newspaperRepository.GetAll();

            _publicationForm.FillListBoxMain(EnumPublications.Newspaper.ToString());
            _publicationForm.FillListBoxMain(newspapers);
        }
Example #5
0
        public IEnumerable <GeneralInformation> GetPublications(int idTypePublication)
        {
            var listPublications = new List <GeneralInformation>();
            var publication      = (TypeOfPublication)idTypePublication;

            if (publication == TypeOfPublication.Newspaper)
            {
                listPublications.AddRange(_newspaperRepository.GetAll().Select(x => new GeneralInformation(x)));
            }
            if (publication == TypeOfPublication.Journal)
            {
                listPublications.AddRange(_journalRepository.GetAll().Select(x => new GeneralInformation(x)));
            }
            if (publication == TypeOfPublication.Book)
            {
                listPublications.AddRange(_bookRepository.GetAll().Select(x => new GeneralInformation(x)));
            }

            return(listPublications);
        }
Example #6
0
 public IEnumerable <NewspaperViewModel> GetAll()
 {
     return(_newspaperRepository.GetAll());
 }