Ejemplo n.º 1
0
        public async Task <GetAllMagazineView> GetAll()
        {
            var magazines = (await _magazineRepository.GetAll()).Select(x => new MagazineGetAllMagazineViewItem {
                Id = x.Id, Title = x.Title, Price = x.Price
            }).ToList();
            GetAllMagazineView result = new GetAllMagazineView();

            result.MagazineItem = magazines;
            return(result);
        }
Ejemplo n.º 2
0
        public GetMagazineListViewModel GetAll()
        {
            var magazines = _magazineRepository.GetAll();
            var result    = new GetMagazineListViewModel();

            foreach (var magazine in magazines)
            {
                result.Magazines.Add(new MagazineGetMagazineListViewModelItem()
                {
                    Id                = magazine.Id,
                    Name              = magazine.Name,
                    Number            = magazine.Number,
                    YearOfPublication = magazine.YearOfPublication
                });
            }

            return(result);
        }