public IHttpActionResult GetAllByGenreName(string key, string contentType) { if (!_genreService.Any(x => x.Locals.Any(y => y.Name == key))) { return(Content(HttpStatusCode.OK, "Genre with such name does not exist")); } var games = _gameService.Get(x => x.Genres.Any(y => y.Locals.Any(z => z.Name == key)), CurrentLanguage); var model = _mapper.Map <IEnumerable <Game>, IList <GameViewModel> >(games); return(Serialize(model, contentType)); }
public IHttpActionResult GetAllByGameKey(string key, string contentType) { if (!_genreService.Any(x => x.Games.Any(y => y.Key == key))) { return(Content(HttpStatusCode.OK, "Game with such key does not have genres")); } var genres = _genreService.Get(x => x.Games.Any(y => y.Key == key), CurrentLanguage); var model = _mapper.Map <IEnumerable <Genre>, IList <GenreViewModel> >(genres); return(Serialize(model, contentType)); }