Esempio n. 1
0
        public HttpResponseMessage ObtainGameByCategory(string category)
        {
            try
            {
                var game = GamesRepository.ConsultGameByCategory(category);

                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));
            }
        }