Esempio n. 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);
        }