public void ShouldGetExistingPlatformType_ById()
        {
            var platformType = new PlatformType("type");

            _mock.Setup(m => m.PlatformTypes.Get(It.IsAny <int>()))
            .Returns(platformType);

            PlatformTypeDto platformTypeDto = _service.Get(It.IsAny <int>());

            Assert.AreEqual("type", platformTypeDto.Type);
        }
        public IHttpActionResult GetGames(string contentType)
        {
            PaginationGames games = _gameService.Get(CurrentLanguage);

            FilterCriteria filter = new FilterCriteria
            {
                Genres        = _genreService.Get(CurrentLanguage),
                Platformtypes = _platformTypeService.Get(CurrentLanguage),
                Publishers    = _publisherService.Get(CurrentLanguage)
            };

            var filterViewModel = _mapper.Map <FilterCriteria, FilterCriteriaViewModel>(filter);

            var pageInfo = new PagingInfoViewModel
            {
                CurrentPage  = 1,
                ItemsPerPage = "10",
                TotalItems   = games.Count
            };

            var result = Serialize(new GamesAndFilterViewModel
            {
                Filter     = filterViewModel,
                Games      = _mapper.Map <IEnumerable <Game>, IList <GameViewModel> >(games.Games),
                PagingInfo = pageInfo
            },
                                   contentType);

            return(result);
        }
Exemple #3
0
        public ActionResult Games()
        {
            var paginInfo = new PagingInfo
            {
                PaginationType = PaginationType.TenPerPage,
                TotalItems     = _gameService.Get().Count(),
                CurrentPage    = 1
            };


            var model = new GameFilterViewModel
            {
                Games =
                    Mapper.Map <IEnumerable <ShowGameViewModel> >(
                        _gameService.GetPaginated(
                            (int)paginInfo.PaginationType,
                            (paginInfo.CurrentPage - 1) * (int)paginInfo.PaginationType)),
                Genres =
                    Mapper.Map <List <GenreViewModel> >(
                        _genreService.Get().Where(_ => _.ParentGenre == null)),
                Platforms =
                    Mapper.Map <List <PlatformTypeViewModel> >(
                        _platformTypeService.Get()),
                Publishers =
                    Mapper.Map <List <PublisherViewModel> >(
                        _publisherService.Get()),
                PagingInfo = paginInfo
            };

            return(View(model));
        }
        public ActionResult AddGame()
        {
            var game = new GameViewModel()
            {
                Genres        = _mapper.Map <IEnumerable <Genre>, IList <GenreViewModel> >(_genreService.Get(g => g.Locals.Any(x => x.Name != "Other"), CurrentLanguageCode)),
                PlatformTypes = _mapper.Map <IEnumerable <PlatformType>, IList <PlatformTypeViewModel> >(_platformTypeService.Get(CurrentLanguageCode)),
                Publishers    = _mapper.Map <IEnumerable <Publisher>, IList <PublisherViewModel> >(_publisherService.Get(CurrentLanguageCode))
            };

            return(View(game));
        }
Exemple #5
0
 public ViewResult Delete(int id)
 {
     return(View(_platformTypeService.Get(id).ToViewModel()));
 }