예제 #1
0
 public async Task <ActionResult> JoinTourney(string id, [FromBody] string userAddress)
 {
     if (await SEModule.JoinTourney(id, userAddress))
     {
         return(Ok("User joined."));
     }
     else
     {
         return(Ok("User could not join because Tournament has reach max capacity or user has already joined."));
     }
 }
예제 #2
0
        public async Task <ActionResult> GetTourney(string id)
        {
            var tourney = await SEModule.GetTourney(id);

            if (tourney != null)
            {
                return(Ok(tourney));
            }
            else
            {
                return(NotFound());
            }
        }
예제 #3
0
        public async Task <ActionResult> CreateNewTourney(TourneyCreationData d)
        {
            // TODO refarctor authentification
            if (await CheckAuthentification())
            {
                var tourneyId = await SEModule.CreateTourney(d);

                return(Ok(tourneyId));
            }
            else
            {
                return(Forbid("Missing or wrong user certification"));
            }
        }
예제 #4
0
 public async Task <ActionResult> PutStartTourney(string id)
 {
     if (await CheckAuthentification())
     {
         if (await SEModule.StartTourney(id))
         {
             return(Ok("Tournament Started"));
         }
         else
         {
             return(NotFound("Tournament ID not found"));
         }
     }
     return(Forbid("Missing or wrong user certification"));
 }
예제 #5
0
 public async Task <ActionResult> PutResolveMatchup(string id, [FromBody] ResolveData resolveData)
 {
     if (await CheckAuthentification())
     {
         if (await SEModule.ResolveMatchup(id, resolveData))
         {
             return(Ok("MatchUp Resolved"));
         }
         else
         {
             return(Ok("MatchUp could not be resolved"));
         }
     }
     return(Forbid("Missing or wrong user certification"));
 }