public ActionResult <List <Round> > Get([FromQuery] string tournament, int userId)
 {
     try
     {
         if (tournament == "tour")
         {
             var list = new List <Round>()
             {
                 _roundService.GetCurrentRoundFromTournament()
             };
             return(Ok(list));
         }
         else if ((tournament == "matches") && (userId > 0))
         {
             var list = new List <Round>()
             {
                 _roundService.GetMatchesByCurrentRoundAndByUserId(userId)
             };
             return(Ok(list));
         }
         else
         {
             return(Ok(_roundService.ReadAll()));
         }
     }
     catch (Exception e)
     {
         return(BadRequest(e.StackTrace));
     }
 }
Ejemplo n.º 2
0
        public List <Match> GetMatchesByCurrentRoundAndByUserId(User user)
        {
            var currentRound = _roundService.GetCurrentRoundFromTournament();
            var matches      = currentRound.Matches.FindAll(m => m.Tips.Equals(user.Tips));

            return(matches);
        }