public string GetCurrentTournament()
 {
     if (KickerToolManagement.IsKickertoolRunning())
     {
         return("{\"kickertoolrunning\" : true }");
     }
     //Check that kicker tool is not runnig, if it is send error
     return(JsonConvert.SerializeObject(service.LoadCurrent()));
 }
        public string DeleteCurrentTournament()
        {
            if (KickerToolManagement.IsKickertoolRunning())
            {
                return("{\"kickertoolrunning\" : true }");
            }

            service.DeleteCurrentTournament();

            return("{\"ok\" : true }");
        }
        public string GetCurrentTournamentFinished()
        {
            if (KickerToolManagement.IsKickertoolRunning())
            {
                return("{\"kickertoolrunning\" : true }");
            }

            var tour = service.LoadCurrent();

            return($"{{\"currenttournamentfinished\" : {service.TournamentFinished(tour)} }}");
        }
        public string GenerateNewTournament([FromBody] NewTournament newT)
        {
            if (KickerToolManagement.IsKickertoolRunning())
            {
                return("{\"kickertoolrunning\" : true }");
            }

            //TODO also make sure that we have it is finished and saved
            var currentFinished = service.CurrentTournamentFinished();

            if (!currentFinished)
            {
                KickerToolManagement.EnsureKickertoolRunning();
                return("{ \"tournamentfinished\" : false \"}");
            }

            var newTour = service.CreateNew(newT.Teams.Select(x => (x.Player1Name, x.Player2Name)).ToList(), newT.Groups, newT.Tables);

            service.SaveTournementAsCurrent(newTour);
            KickerToolManagement.EnsureKickertoolRunning();


            return("{ \"ok\" : true}");
        }