Esempio n. 1
0
        public GetMagazineViewModel GetAll()
        {
            var magazineEntities = _magazineRepository.GetAll();
            var magazineViews    = new GetMagazineViewModel();

            magazineViews.Magazines = Mapper.Map <IEnumerable <Magazine>, List <GetMagazineViewItem> >(magazineEntities);
            return(magazineViews);
        }
Esempio n. 2
0
        public GetMagazineViewModel Get(long id)
        {
            var magazine = _magazineRepository.Get(id);

            if (magazine == null)
            {
                throw new BusinessLogicException("Magazine not found");
            }

            var result = new GetMagazineViewModel()
            {
                Id                = magazine.Id,
                Name              = magazine.Name,
                Number            = magazine.Number,
                YearOfPublication = magazine.YearOfPublication
            };

            return(result);
        }
Esempio n. 3
0
        public IActionResult Get()
        {
            GetMagazineViewModel listMagazines = _magazineService.GetAll();

            return(Ok(listMagazines));
        }