//outside methods towards clients //passing the shareid that was modified. Check which user is interested and notify it public void NotifyShareChanges(ShareModel shareModified) { //debug InterestedShareQuery shareQuery = new InterestedShareQuery { ShareId = shareModified.Id, ActualPrice = shareModified.Price }; ShareOutViewModel outViewShare = new ShareOutViewModel(shareModified); ICollection <InterestedShareModel> usersToNotify = _repository.GetInfoInterestedShare(shareQuery); foreach (InterestedShareModel shareModel in usersToNotify) { Clients.User(shareModel.UserId).receiveStockMessage("the share you are interested " + shareModel.ShareId + " has moved price into your interest"); } UpdateShares(outViewShare); }
public void UpdateShares(ShareOutViewModel outViewShare) { //try to update the table to all the users in real time Clients.All.updateStockPrice(outViewShare); }