public IHttpActionResult GetAllByCompanyName(string key, string contentType) { if (!_publisherService.Any(x => x.CompanyName == key)) { return(Content(HttpStatusCode.OK, "Publisher with such company name does not exist")); } var games = _gameService.Get(x => x.Publisher.CompanyName == key, CurrentLanguage); var model = _mapper.Map <IEnumerable <Game>, IList <GameViewModel> >(games); return(Serialize(model, contentType)); }
public IHttpActionResult GetAllByGameKey(string key, string contentType) { if (!_publisherService.Any(x => x.Games.Any(y => y.Key == key))) { return(Content(HttpStatusCode.OK, "Game with such key does not have publishers")); } var publishers = _publisherService.Get(x => x.Games.Any(y => y.Key == key), CurrentLanguage); var model = _mapper.Map <IEnumerable <Publisher>, IList <PublisherViewModel> >(publishers); return(Serialize(model, contentType)); }
private bool PublisherExists(int id) { return(_iPublisherService.Any(e => e.Id == id)); }