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(); var totalPoints = todoService.CalculateTotalPoints(); var tally = new PointTally { PointsAvailable = totalPoints }; var notifictionUrl = ConfigurationManager.AppSettings["notificationUrl"]; using (var client = new WebClient()) { client.Headers.Add("Content-Type", @"application/json"); var serializedTally = JsonConvert.SerializeObject(tally); client.UploadString(notifictionUrl, serializedTally); } }