public void Send(int id, string message) { InternalNotificationsRepository notificationsRepository = new InternalNotificationsRepository(new Domain.Staff.ErpStaffDbContext()); var q = notificationsRepository.GetInternalNotificationsById(id); var listStaffCanView = StaffClients.Where(x => ("," + q.PlaceOfReceipt + ",").Contains("," + x.UserLoggedId + ",")).Select(x => x.ConnectionID).ToList(); Clients.Clients(listStaffCanView).addNotification(id, message); //Clients.All.addNotification(id, message); }
public IEnumerable <InternalNotifications> FetchInternalNotifications() { InternalNotificationsRepository internalNotificationsRepository = new InternalNotificationsRepository(new Domain.Staff.ErpStaffDbContext()); List <InternalNotifications> NotificationsList = internalNotificationsRepository.GetAllInternalNotifications().AsEnumerable() .Select(item => new InternalNotifications { Id = item.Id, Titles = item.Titles }).ToList(); NotificationsList.Insert(0, new InternalNotifications() { Id = -1, Titles = "- Rỗng -" }); return(NotificationsList); }