Exemple #1
0
 public HttpResponseMessage AddGameScore(GamesScoreModel gameScoreModel)
 {
     try
     {
         GamesScoreModel gameScore = gamescorelogic.AddGameScore(gameScoreModel);
         return(Request.CreateResponse(HttpStatusCode.Created, gameScore));
     }
     catch (Exception ex)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex));
     }
 }
Exemple #2
0
        //Add Game Result
        public GamesScoreModel AddGameScore(GamesScoreModel gameScoreModel)
        {
            DateTime  nowTime   = DateTime.Now;
            GameScore gameScore = new GameScore
            {
                UserID       = gameScoreModel.userId,
                GameDateTime = nowTime,
                GameDuration = gameScoreModel.gameDuration,
                GameMoves    = gameScoreModel.moves
            };

            DB.GameScores.Add(gameScore);
            DB.SaveChanges();
            gameScoreModel.id = gameScore.ScoreID;
            return(gameScoreModel);
        }