コード例 #1
0
        public ActionResult EditBattle(Guid id)
        {
            var dto   = _battleService.GetBattleById(id);
            var model = _mapper.Map <BattleViewModel>(dto);

            return(View(model));
        }
コード例 #2
0
        public IActionResult PostBattleActions(int battleId, [FromBody] List <BattleAction> battleActions)
        {
            var battle = _battleService.GetBattleById(battleId);

            if (battle != null && battleActions != null)
            {
                // check to make sure authenticated user is the user for this battle
                // TODO: Validate authenticated user versus battle user

                var result = battle.DoRound(battleActions);

                return(Json(result));
            }
            return(BadRequest());
        }