예제 #1
0
        public async Task <IActionResult> GetAllCharacterForAccountIdAndServerAsync(Guid userId, int server)
        {
            var tokenPayload = HttpContext.Request.Headers["authorization"];

            if (JWTPayload.AdminPayload(tokenPayload))
            {
                var characters = await _characterService.GetAllCharacterForAccountIdAndServerAsync(userId, server);

                if (characters == null)
                {
                    return(NotFound());
                }
                return(Json(characters));
            }
            else
            {
                if (JWTPayload.TokenPayload(tokenPayload, userId))
                {
                    var characters = await _characterService.GetAllCharacterForAccountIdAndServerAsync(userId, server);

                    if (characters == null)
                    {
                        return(NotFound());
                    }
                    return(Json(characters));
                }
                else
                {
                    return(NotFound());
                }
            }
        }
예제 #2
0
        public async Task <IActionResult> Get(Guid userId)
        {
            var tokenPayload = HttpContext.Request.Headers["authorization"];

            if (JWTPayload.TokenPayload(tokenPayload, userId))
            {
                var account = await _accountService.GetAsync(userId);

                if (account == null)
                {
                    return(NotFound());
                }
                return(Json(account));
            }
            else
            {
                return(NotFound());
            }
        }
예제 #3
0
        public async Task <IActionResult> GetAsync(Guid userId, string name, int server)
        {
            var tokenPayload = HttpContext.Request.Headers["authorization"];

            if (JWTPayload.TokenPayload(tokenPayload, userId))
            {
                var character = await _characterService.GetAsync(name, server);

                if (character == null)
                {
                    return(NotFound());
                }
                return(Json(character));
            }
            else
            {
                return(NotFound());
            }
        }
예제 #4
0
        public async Task <IActionResult> Get(Guid userId, string charName, int server)
        {
            var tokenPayload = HttpContext.Request.Headers["authorization"];

            if (JWTPayload.TokenPayload(tokenPayload, userId))
            {
                var info = await _info.GetAsync(userId, charName, server);

                if (info == null)
                {
                    return(NotFound());
                }
                return(Json(info));
            }
            else
            {
                return(NotFound());
            }
        }