public ActionResult GetHistoryForPlayer(int playerId, string status, DateTime?date) { if (date == null) { // filter by status if provided var was = status == null ? _ratingHistoryRepository.GetAllWeeklyByPlayerId(playerId) : _ratingHistoryRepository.GetAllWeeklyByPlayerId(playerId, RatingsHelper.RatingStatusFromString(status)); // return list of history return(new JsonResult( was.Select(w => new { w.Date, w.Rating, w.RatingStatus }), new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, Formatting = Formatting.None } )); } // filter by status if provided var wa = status == null ? _ratingHistoryRepository.GetWeeklyOnDateByPlayerId(playerId, (DateTime)date) : _ratingHistoryRepository.GetWeeklyOnDateByPlayerId(playerId, (DateTime)date, RatingsHelper.RatingStatusFromString(status)); if (wa == null) { return(StatusCode(204)); } return(new JsonResult( new { wa.Date, wa.Rating, wa.RatingStatus }, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, Formatting = Formatting.None } )); }
protected void Page_Load(object sender, EventArgs e) { var helper = new RatingsHelper(); litDisplayStars.Text = helper.GetGlobalRating(Sitecore.Context.Item); }