Ejemplo n.º 1
0
        public HttpResponseMessage Post(GameDTO gameDTO)
        {
            HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.InternalServerError);

            try
            {
                if (ModelState.IsValid)
                {
                    GameBusiness gameBusiness = new GameBusiness();

                    gameBusiness.Create(gameDTO);

                    response = Request.CreateResponse(HttpStatusCode.OK, "Game successfully created");
                }
                else
                {
                    response = Request.CreateResponse(HttpStatusCode.BadRequest, "The request object doesn't match with the requirement");
                }
            }
            catch (Exception e)
            {
                Logger.Error("GameController", "Get", e.Message);
                response = Request.CreateResponse(HttpStatusCode.InternalServerError, "Unexpected error");
            }

            return response;
        }
Ejemplo n.º 2
0
        public void Create()
        {
            var gameBusiness = new GameBusiness();

            var requestObject = new GameDTO()
            {
                Id   = 0,
                Name = "Game2"
            };

            gameBusiness.Create(requestObject);
        }