コード例 #1
0
 public IActionResult GetStatus([FromBody] GetStatusInput data)
 {
     if (ModelState.IsValid)
     {
         var res = _game.GetStatus(data);
         return(Ok(res));
     }
     return(BadRequest(ModelState));
 }
コード例 #2
0
 public GetStatusOutput GetStatus(GetStatusInput data)
 {
     players.TryGetValue(data.PlayerID, out var player);
     if (player == null)
     {
         return(new GetStatusOutput()
         {
             HasHighestScore = false,
             Score = 0,
             Status = PlayerStatus.Unknown.ToString()
         });
     }
     return(new GetStatusOutput()
     {
         Status = player.Status.ToString(),
         Score = player.CurrentScore,
         HasHighestScore = player.HighestScore
     });
 }