コード例 #1
0
        public async Task <IActionResult> CreateMasterGameChangeRequest([FromBody] MasterGameChangeRequestRequest request)
        {
            var currentUser = await _userManager.FindByNameAsync(User.Identity.Name);

            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            Maybe <MasterGame> masterGame = await _interLeagueService.GetMasterGame(request.MasterGameID);

            if (masterGame.HasNoValue)
            {
                return(NotFound());
            }

            MasterGameChangeRequest domainRequest = request.ToDomain(currentUser, _clock.GetCurrentInstant(), masterGame.Value);
            await _interLeagueService.CreateMasterGameChangeRequest(domainRequest);

            return(Ok());
        }
コード例 #2
0
    public async Task <IActionResult> CreateMasterGameChangeRequest([FromBody] MasterGameChangeRequestRequest request)
    {
        var currentUserResult = await GetCurrentUser();

        if (currentUserResult.IsFailure)
        {
            return(BadRequest(currentUserResult.Error));
        }
        var currentUser = currentUserResult.Value;

        MasterGame?masterGame = await _interLeagueService.GetMasterGame(request.MasterGameID);

        if (masterGame is null)
        {
            return(NotFound());
        }

        MasterGameChangeRequest domainRequest = request.ToDomain(currentUser, _clock.GetCurrentInstant(), masterGame);
        await _interLeagueService.CreateMasterGameChangeRequest(domainRequest);

        return(Ok());
    }