コード例 #1
0
        public virtual IActionResult Login([FromBody] AuthRequest request)
        {
            mLogger.Info("", Codes.Login, "User login attempt.", mReferenceId, new { request.Id });

            try
            {
                var result = mCore.AuthenticationApi.Authenticate(request);
                if (result.IsSuccess)
                {
                    Response.Cookies.Append(mConfig["service:cookie-key"], Guid.NewGuid().ToString("n"));
                }

                mLogger.Info("", Codes.Login, "User login success.", mReferenceId, new { request.Id });
                return(new ObjectResult(result));
            }
            catch (NotValidRequestException exception)
            {
                mLogger.Info("SomeUser", Codes.Login, "Login error", mReferenceId, new { request.Id });
                return(BadRequest(exception.Message));
            }
        }
コード例 #2
0
        public virtual IActionResult CreateTournament([FromBody] TournamentCreationRequest request)
        {
            mLogger.Info("", Codes.TournamentCreation, "Tournament creation attempt", mReferenceId, request);

            var createdTournament = mCore.TournamentsApi.CreateTournament(request);

            mLogger.Info("", Codes.TournamentCreation, "Tournament created", mReferenceId);
            return(new ObjectResult(createdTournament));
        }