public static void UpdateNotification(string ToUser, int CompanyID, int number) { UserOnline us = new UserOnline(); List <UserOnlineModel> list = us.GetUserOnline(); IHubContext context = GlobalHost.ConnectionManager.GetHubContext <UserNoti>(); foreach (UserOnlineModel item in list) { if (item.UserName.Trim().ToLower() == ToUser.Trim().ToLower() && item.Company == CompanyID) { context.Clients.Client(item.ClientID).updateUsersNotification(number); break; } } }
public static void SendMessage(MessageNotification model) { UserOnline us = new UserOnline(); List <UserOnlineModel> list = us.GetUserOnline(); IHubContext context = GlobalHost.ConnectionManager.GetHubContext <UserNoti>(); foreach (UserOnlineModel item in list) { if (item.UserName.Trim().ToLower() == model.ToUser.Trim().ToLower() && item.Company == model.CompanyID) { context.Clients.Client(item.ClientID).showUsersNotification(model); break; } } }