public IHttpActionResult Put(CardGameEdit cardGame)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var service = CreateCardGameService();

            if (!service.UpdateCardGame(cardGame))
            {
                return(InternalServerError());
            }

            return(Ok());
        }
        public bool UpdateCardGame(CardGameEdit model)
        {
            using (var ctx = new ApplicationDbContext())
            {
                var entity =
                    ctx
                    .CardGames
                    .Single(e => e.GameId == model.GameId);

                entity.AgeRating          = model.AgeRating;
                entity.MaxNumberOfPlayers = model.MaxNumberOfPlayers;
                entity.MinNumberOfPlayers = model.MinNumberOfPlayers;
                entity.NumberOfCards      = model.NumberOfCards;
                entity.ExtraEquipmentUsed = model.ExtraEquipmentUsed;
                entity.IsGamblingGame     = model.IsGamblingGame;
                entity.AvgPlayTimeInMin   = model.AvgPlayTimeInMin;

                return(ctx.SaveChanges() == 1);
            }
        }