Ejemplo n.º 1
0
        public IActionResult GetNextSquadplayer()
        {
            try {
                var    decodedToken = authentication.DecodeTokenFromRequest(Request.Headers["Authorization"]);
                string role         = authentication.GetRoleFromToken(decodedToken);
                int    id           = authentication.GetIDFromToken(decodedToken);

                if (role == "Club")
                {
                    List <SquadPlayer> spl = _clubLogic.GetNextSquadplayer(id);

                    if (spl != null)
                    {
                        return(Ok(spl));
                    }
                    else
                    {
                        return(StatusCode(404, "Resource not found"));
                    }
                }
                return(StatusCode(500, "Failed"));
            }
            catch (Exception) {
                return(StatusCode(500, "Failed"));
            }
        }