コード例 #1
0
        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));
        }
コード例 #2
0
        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));
        }
コード例 #3
0
 private bool PublisherExists(int id)
 {
     return(_iPublisherService.Any(e => e.Id == id));
 }