public GetStatisticsResult GetStatistics(CommonRequest request) { var result = new GetStatisticsResult(); try { User user = null; if (request.UserName != null) { user = _cache.RefreshAndGet( Users, request.UserName, new UserNotFoundException("User was not found, can't get statistics") ); } result.WinRateStatistics = user.GetWinRateStatistics(); result.GrossProfitWinRateStatistics = user.GetGrossProfitWinRateStatistics(); result.Success = true; } catch (PokerException e) { result.ErrorMessage = e.Message; result.Success = false; Logger.Error(e, this); } return(result); }
public HttpResponseMessage GetStatistics(CommonRequest request) { var result = new GetStatisticsResult(); try { result = service.GetStatistics(request); } catch (Exception e) { result.ErrorMessage = e.Message; result.Success = false; return(Request.CreateResponse(HttpStatusCode.InternalServerError, result)); } return(Request.CreateResponse(HttpStatusCode.OK, result)); }
public GetStatisticsResponse(GetStatisticsResult statistics) => Statistics = statistics;