Beispiel #1
0
        public HttpResponseMessage ConfirmScore(CompetitorScore competitorScore)
        {
            Result <bool> res = competitorBusiness.ConfirmScore(competitorScore);

            if (res.Success && res.Data)
            {
                int   totalMatches = matchBusiness.TotalMatchesByStatus(MatchStatus.Confirmed);
                Match match        = matchBusiness.GetMatchById(competitorScore.MatchID).Data;
                if (match != null)
                {
                    matchBusiness.LoadScores(match);
                    match.Game = gameBusiness.GetById(match.GameID).Data;
                }
                LiveScores.Instance.BroadcastTotalMatches(match, totalMatches);
            }

            HttpResponseMessage response = res.Success ?
                                           Request.CreateResponse(HttpStatusCode.OK) :
                                           Request.CreateResponse(HttpStatusCode.InternalServerError, "Error confirming score");

            return(response);
        }
Beispiel #2
0
        public HttpResponseMessage GetStats()
        {
            Playground.Model.ViewModel.PlaygroundStats res = new Model.ViewModel.PlaygroundStats()
            {
                TotalPlaygrounds = playgroundBusiness.TotalPlaygroundsCound(),
                TotalGames       = gameBusiness.TotalGamesCount(),
                TotalUsers       = userBusiness.TotalUsersCount(),
                TotalPlayers     = competitorBusiness.TotalCompetitorsCount(),
                TotalMatches     = matchBusiness.TotalMatchesByStatus(MatchStatus.Confirmed)
            };


            HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK, res);

            return(response);
        }