Exemplo n.º 1
0
        public HttpResponseMessage ObtainGameByTitle(string title)
        {
            try
            {
                var game = GamesRepository.ConsultGameByTitle(title);

                if (game == null)
                {
                    return(Request.CreateResponse(HttpStatusCode.NotFound));
                }

                return(Request.CreateResponse(HttpStatusCode.OK, game));
            }
            catch (Exception e)
            {
                Console.WriteLine($"An Exception has been caught: {e.Message}");

                return(Request.CreateResponse(HttpStatusCode.InternalServerError));
            }
        }