コード例 #1
0
ファイル: ColorService.cs プロジェクト: joeyshipley/ColorTime
        public PlayViewResponse PlayView(PlayViewRequest request)
        {
            if(!request.PlayerId.HasValue)
                return new PlayViewResponse
                {
                    CanPlayGame = false,
                    RequestPlayerInfo = true
                };

            var player = _playerRepository.Get(request.PlayerId.Value);
            return new PlayViewResponse
            {
                PlayerId = player.Id,
                PlayerName = player.Name,
                Score = player.CalculateScore(),
                CanPlayGame = true,
                RequestPlayerInfo = false
            };
        }
コード例 #2
0
 public ActionResult View(PlayViewRequest request)
 {
     var response = _colorService.PlayView(request);
     var model = _colorModelFactory.CreatePlayViewModel(response);
     return View("Index", model);
 }