Exemple #1
0
        public IEnumerable <BrochureViewModel> GetAll()
        {
            List <Brochure> brochures = _brochureRepository.GetAll().ToList();
            var             result    = Mapper.Map <List <Brochure>, List <BrochureViewModel> >(brochures);

            return(result);
        }
        public IList <BrochureViewModel> GetBrochures()
        {
            Save.SaveItems(_brochureRepository.GetAll(), "../Brochures");
            var brochures =
                Mapper.Map <IList <Brochure>, IList <BrochureViewModel> >(_brochureRepository.GetAll());

            return(brochures);
        }
        public GetBrochureViewModel GetAll()
        {
            var brochureEntities = _brochureRepository.GetAll();
            var brochureViews    = new GetBrochureViewModel();

            brochureViews.Brochures = Mapper.Map <IEnumerable <Brochure>, List <GetBrochureViewItem> >(brochureEntities);
            return(brochureViews);
        }
Exemple #4
0
        public async Task <GetAllBrochureViewModel> GetAll()
        {
            var result = new GetAllBrochureViewModel();
            IEnumerable <Brochure> brochuresList = await _brochureRepository.GetAll();

            var brochureVMItemList = Mapper.Map <IEnumerable <Brochure>, List <BrochureGetAllBrochureViewModelItem> >(brochuresList);

            result.Brochures = brochureVMItemList;
            return(result);
        }
Exemple #5
0
        public GetBrochureView GetAll()
        {
            var brochureViewModel = new GetBrochureView();

            var allBrochuresModel = _brochureRepository.GetAll();
            List <BrochureGetBrochureViewItem> allBrochuresViewModel = Mapper.Map <List <Brochure>, List <BrochureGetBrochureViewItem> >(allBrochuresModel);

            brochureViewModel.Brochures = allBrochuresViewModel;

            return(brochureViewModel);
        }
 private IEnumerable <Publication> GetAllPublications()
 {
     _publicationList = new List <Publication>();
     _publicationList = _bookRepository.GetAll().Select(x => new Publication {
         Name = x.Name, Type = PublicationType.Book
     })
                        .Concat(_brochureRepository.GetAll().Select(x => new Publication {
         Name = x.Name, Type = PublicationType.Brochure
     }))
                        .Concat(_magazineRepository.GetAll().Select(x => new Publication {
         Name = x.Name, Type = PublicationType.Magazine
     }));
     return(_publicationList);
 }
Exemple #7
0
        public IEnumerable <LibraryViewModel> GetLibrary()
        {
            List <Book> books     = _bookRepository.GetAll().ToList();
            var         viewBooks = Mapper.Map <List <Book>, List <LibraryViewModel> >(books);

            List <Brochure> brochures     = _brochureRepository.GetAll().ToList();
            var             viewBrochures = Mapper.Map <List <Brochure>, List <LibraryViewModel> >(brochures);

            List <Magazine> magazines     = _magazineRepository.GetAll().ToList();
            var             viewMagazines = Mapper.Map <List <Magazine>, List <LibraryViewModel> >(magazines);

            List <LibraryViewModel> library = new List <LibraryViewModel>();

            library.AddRange(viewBooks);
            library.AddRange(viewBrochures);
            library.AddRange(viewMagazines);

            return(library);
        }
        public GetAllPublicationView GetAll()
        {
            var allPublicationsViewModel = new GetAllPublicationView();

            var allBooks = new List <Book>();

            allBooks = _bookRepository.GetAll();
            var allMagazines = new List <Magazine>();

            allMagazines = _magazineRepository.GetAll();
            var allBrochures = new List <Brochure>();

            allBrochures = _brochureRepository.GetAll();

            var allPublicationsModel = new List <PublicationGetAllPublicationView>();

            foreach (var book in allBooks)
            {
                allPublicationsModel.Add(new PublicationGetAllPublicationView()
                {
                    Id = book.Id, Name = book.Name, Type = nameof(Book)
                });
            }
            foreach (var magazine in allMagazines)
            {
                allPublicationsModel.Add(new PublicationGetAllPublicationView()
                {
                    Id = magazine.Id, Name = magazine.Name, Type = nameof(Magazine)
                });
            }
            foreach (var brochure in allBrochures)
            {
                allPublicationsModel.Add(new PublicationGetAllPublicationView()
                {
                    Id = brochure.Id, Name = brochure.Name, Type = nameof(Brochure)
                });
            }

            allPublicationsViewModel.Publications = allPublicationsModel;

            return(allPublicationsViewModel);
        }
        public GetPublicationViewModel GetAll()
        {
            var publicationView = new List <GetPublicationViewItem>();

            var bookEntities     = _bookRepository.GetAll();
            var magazineEntities = _magazineRepository.GetAll();
            var brochureEntities = _brochureRepository.GetAll();

            var bookViews     = Mapper.Map <IEnumerable <Book>, List <GetBookViewItem> >(bookEntities);
            var magazineViews = Mapper.Map <IEnumerable <Magazine>, List <GetMagazineViewItem> >(magazineEntities);
            var brochureViews = Mapper.Map <IEnumerable <Brochure>, List <GetBrochureViewItem> >(brochureEntities);

            publicationView.AddRange(bookViews);
            publicationView.AddRange(magazineViews);
            publicationView.AddRange(brochureViews);

            var result = new GetPublicationViewModel();

            result.Publications = publicationView;

            return(result);
        }
Exemple #10
0
        public IEnumerable <LibraryViewModel> GetLibrary()
        {
            List <Book> books     = _bookRepository.GetAll().ToList();
            var         viewBooks = Mapper.Map <List <Book>, List <LibraryViewModel> >(books);

            List <Brochure> brochures     = _brochureRepository.GetAll().ToList();
            var             viewBrochures = Mapper.Map <List <Brochure>, List <LibraryViewModel> >(brochures);

            List <Gournal> gournals     = _gournalRepository.GetAll().ToList();
            var            viewGournals = Mapper.Map <List <Gournal>, List <LibraryViewModel> >(gournals);

            List <Publication> publications = _publicationRepository.GetAll().ToList();
            var viewPublications            = Mapper.Map <List <Publication>, List <LibraryViewModel> >(publications);

            List <LibraryViewModel> library = new List <LibraryViewModel>();

            library.AddRange(viewBooks);
            library.AddRange(viewBrochures);
            library.AddRange(viewGournals);
            library.AddRange(viewPublications);

            return(library);
        }
Exemple #11
0
        public GetBrochureViewModel GetAll()
        {
            IEnumerable <Brochure> brochuresList = _brochureRepository.GetAll();

            return(Mapper.Map <IEnumerable <Brochure>, GetBrochureViewModel>(brochuresList));
        }