public void CompleteGameSessionForUser(XrefGameSessionUser gameSessionUser) { try { var gameSession = context.XrefGameSessionUsers .FirstOrDefault(g => g.GameSessionID == gameSessionUser.GameSessionID && g.UserId == gameSessionUser.UserId); if (gameSession == null) { throw new NullReferenceException("Missing game session for current User"); } if (gameSession.Finished == true) { return; } gameSession.TotalTime = gameSessionUser.TotalTime; gameSession.Points = gameSessionUser.Points; gameSession.Finished = gameSessionUser.Finished; context.SaveChanges(); } catch (Exception ex) { throw; } }
public void CompleteGameSessionForUser([FromBody] XrefGameSessionUser gameSessionUser) { try { gameSessionService.CompleteGameSessionForUser(gameSessionUser); } catch (Exception) { throw; } }
public void CompleteGameSessionForUser(XrefGameSessionUser gameSessionUser) { try { gameSessionRepository.CompleteGameSessionForUser(gameSessionUser); } catch (Exception ex) { throw; } }
public async Task CompleteGameSessionForUser(int gameSessionId, int userId, string totalTime, int totalUserPoints) { try { var gameSessionForUser = new XrefGameSessionUser() { GameSessionID = gameSessionId, UserId = userId, TotalTime = totalTime, Points = totalUserPoints, Finished = true }; await client.PutAsJsonAsync <XrefGameSessionUser>("api/gamesession/completegamesessionforuser", gameSessionForUser); } catch (Exception ex) { throw; } }