Ejemplo n.º 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());
                }
            }
        }