public void FetchTotals()
 {
     var todoService = new TodoServiceDB();
     var pointTally = new PointTally {
         PointsAvailable = todoService.CalculateTotalPoints()
     };
     Clients.All.OnTotalsUpdated(pointTally);
 }
        public void HandleChange(NotificationEvent changeEvent)
        {
            Trace.TraceInformation(changeEvent.Content);

            // add up the points
            var todoService = new TodoServiceDB();
            int totalPoints = todoService.CalculateTotalPoints();
            var tally = new PointTally {
                PointsAvailable = totalPoints
            };

            string notifictionUrl = ConfigurationManager.AppSettings["notificationUrl"];
            using (var client = new WebClient()) {
                client.Headers.Add("Content-Type", @"application/json");
                string serializedTally = JsonConvert.SerializeObject(tally);
                client.UploadString(notifictionUrl, serializedTally);
            }
        }