Exemplo n.º 1
0
        public virtual HttpResponseMessage UpdateGame([FromBody] GameModel game)
        {
            if (game == null)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, "Game was null."));
            }
            if (game.Scores == null)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, "Scores was null."));
            }
            if (game.Scores.Count() < 5)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, "Scores must contain at least 5 items."));
            }
            var id = DataBridge.UpdateGame(game);

            return(Request.CreateResponse(HttpStatusCode.OK, id));
        }