public void GetReport(long id) { Log.Verbose("OprHub - GetReport - id={0}: {0}", id, this.GetUserName()); using (var db = new OprContext()) { var report = db.GetReport(id, includeReports: true).SingleOrDefault(); Log.Debug("Report = {0}", JsonConvert.SerializeObject(report)); Clients.Caller.loadReport(report); } }
/// <summary> /// Get the latest comments (one for each type) /// </summary> /// <param name="reportId"></param> public void GetLatestComments(long reportId) { Log.Debug("Socket - GetLatestComments called by {0} with {1}", this.GetUserName(), reportId); using (var db = new OprContext()) { var report = db.GetReport(reportId, includeComments: true).SingleOrDefault(); if (report != null && report.CommentHistory != null) { var comments = report.CommentHistory.Comments .OrderByDescending(c => c.ModifiedOn) .GroupBy(c => c.Type, (key, g) => new { Type = key, Comment = g.FirstOrDefault() }).ToArray(); Clients.Caller.loadComments(comments); } } }