public ViewResult Create() { var platforms = _platformService.GetAllPlatform().Select(a => a.Name).ToList(); var genres = _genreService.GetAllGenres().Select(a => a.Name).ToList(); var publishers = _publisherService.GetAllPublisherCompanyNames().ToList(); var gameCreate = new GameViewModel { GamePlatforms = platforms, GameGenres = genres, Publishers = publishers }; return(View(gameCreate)); }
public IActionResult GetAll() { var platforms = _platformService.GetAllPlatform(); var platformsView = _mapper.Map <IEnumerable <PlatformTypeViewModel> >(platforms); if (!platforms.Any()) { return(StatusCode(StatusCodes.Status404NotFound)); } return(Ok(platformsView)); }