/// <summary> /// Send the sales to everyone! /// </summary> /// <param name="sales"></param> public void SalesUpdated(SalesInfoViewModel salesInfo) { try { this.SendToAll(salesInfo, "sales-updated"); } catch (Exception ex) { this.SendError(ex, "Error in SalesController.SalesUpdated"); } }
/// <summary> /// Send the sales to the client asking for it /// </summary> public void GetSales() { try { using (var a = kernel.BeginBlock()) { var service = a.Get<ISalesService>(); var salesData = service.GetAllReadOnly().ToList(); var salesInfo = new SalesInfoViewModel(salesData.Select(sales => new SalesViewModel(sales)).ToList(), salesData.OrderByDescending(p => p.Updated).Select(p => p.Updated).First()); this.Send(salesInfo, "sales-updated"); } } catch (Exception ex) { this.SendError(ex,"Error in SalesController.GetSales"); } }