Пример #1
0
        public HttpResponseMessage GetStats(long id)
        {
            Result <Player> playerRes = competitorBusiness.GetPlayerById(id);
            PlayerStats     result    = null;

            if (playerRes.Success)
            {
                result = new PlayerStats(playerRes.Data);
                result.GameCategory = gameCategoryBusiness.GetByCompetitorId(id);
                result.TotalMatches = competitorBusiness.TotalMatchesCount(id);
            }

            HttpResponseMessage response = playerRes.Success ?
                                           Request.CreateResponse(HttpStatusCode.OK, result) :
                                           Request.CreateResponse(HttpStatusCode.InternalServerError, playerRes.Message);

            return(response);
        }