// PUT api/Games/5
 public HttpResponseMessage Put(int id, [FromBody] GamesResolut value)
 {
     using (WebAPI_FP_TournamentGamesEntities entities = new WebAPI_FP_TournamentGamesEntities())
     {
         GamesResolut wanted = entities.GamesResoluts.FirstOrDefault(t => t.ID == id);
         if (wanted != null)
         {
             wanted.Game_Name = value.Game_Name;
             wanted.Player1   = value.Player1;
             wanted.Player2   = value.Player2;
             wanted.Who_Won_  = value.Who_Won_;
             //entities.SaveChanges();
             try
             {
                 //db.SaveChanges();
                 entities.SaveChanges();
             }
             catch (DbEntityValidationException ex)
             {
                 Console.WriteLine(ex);
             }
             return(Request.CreateResponse(HttpStatusCode.Accepted, wanted));
         }
         else
         {
             return(Request.CreateResponse(HttpStatusCode.NotFound, string.Format("The game with id: {0} not found", id)));
         }
     }
 }
 // POST api/Games
 public HttpResponseMessage Post([FromBody] GamesResolut value)
 {
     using (WebAPI_FP_TournamentGamesEntities entities = new WebAPI_FP_TournamentGamesEntities())
     {
         entities.GamesResoluts.Add(value);
         entities.SaveChanges();
         return(Request.CreateResponse(HttpStatusCode.Created, new Uri(Request.RequestUri + value.ID.ToString())));
     }
 }
 // DELETE api/Games/5
 public HttpResponseMessage Delete(int id)
 {
     using (WebAPI_FP_TournamentGamesEntities entities = new WebAPI_FP_TournamentGamesEntities())
     {
         GamesResolut wanted = entities.GamesResoluts.FirstOrDefault(t => t.ID == id);
         if (wanted != null)
         {
             entities.GamesResoluts.Remove(wanted);
             entities.SaveChanges();
             return(Request.CreateResponse(HttpStatusCode.Accepted, string.Format("The game with id: {0} deleted", id)));
         }
         else
         {
             return(Request.CreateResponse(HttpStatusCode.NotFound, string.Format("The game with id: {0} not found", id)));
         }
     }
 }
 // DELETE api/GamesResults/5
 public HttpResponseMessage Delete(int id)
 {
     using (WebAPI_FP_TournamentGamesEntities entities = new WebAPI_FP_TournamentGamesEntities())
     {
         GamesResult game = entities.GamesResults.FirstOrDefault(t => t.ID == id);
         if (game != null)
         {
             entities.GamesResults.Remove(game);
             entities.SaveChanges();
             return(Request.CreateResponse(HttpStatusCode.Accepted, string.Format("Game with id: {0} , was deleted.", id)));
         }
         else
         {
             return(Request.CreateResponse(HttpStatusCode.NotFound, string.Format("Game with id : {0} , NOT FOUND!!!", id)));
         }
     }
 }
 // PUT api/GamesResults/5
 public HttpResponseMessage Put(int id, [FromBody] GamesResult game)
 {
     using (WebAPI_FP_TournamentGamesEntities entities = new WebAPI_FP_TournamentGamesEntities())
     {
         GamesResult gameUpdate = entities.GamesResults.FirstOrDefault(t => t.ID == id);
         if (gameUpdate != null)
         {
             gameUpdate.Game_Name = game.Game_Name;
             gameUpdate.Player1   = game.Player1;
             gameUpdate.Player2   = game.Player2;
             gameUpdate.Who_Won_  = game.Who_Won_;
             entities.SaveChanges();
             return(Request.CreateResponse(HttpStatusCode.Accepted, gameUpdate));
         }
         else
         {
             return(Request.CreateResponse(HttpStatusCode.NotFound, string.Format("Game with id : {0} , NOT FOUND!!!", id)));
         }
     }
 }