/// <summary> /// Send the sales to everyone! /// </summary> /// <param name="salesInfo"></param> public void SalesUpdated(SalesInfoViewModel salesInfo) { try { this.InvokeToAll(salesInfo, "sales-updated"); } catch (Exception ex) { this.InvokeError(ex, "Error in SalesController.SalesUpdated"); } }
/// <summary> /// Send the sales to everyone! /// </summary> /// <param name="salesInfo"></param> public async Task SalesUpdated(SalesInfoViewModel salesInfo) { try { await this.InvokeToAll(salesInfo, "sales-updated"); } catch (Exception ex) { await this.InvokeError(ex, "Error in SalesController.SalesUpdated"); } }
/// <summary> /// Send the sales to the client asking for it /// </summary> public void GetSales() { try { var service = kernel.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.Invoke(salesInfo, "sales-updated"); } catch (Exception ex) { this.InvokeError(ex, "Error in SalesController.GetSales"); } }
/// <summary> /// Send the sales to the client asking for it /// </summary> public async Task GetSales() { try { var service = kernel.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()); await this.Invoke(salesInfo, "sales-updated"); } catch (Exception ex) { await this.InvokeError(ex, "Error in SalesController.GetSales"); } }