public IActionResult Post([FromQuery] string userName, [FromBody] NotificationCM model) { var _user = _userManager.FindByNameAsync(userName).Result; if (_user != null) { var notification = new Notification { Title = model.Title, Type = model.Type, Body = model.Body, UserId = _user.Id, NData = model.NData == null ? null : JsonConvert.SerializeObject(model.NData), IsSeen = false, DateCreated = DateTime.Now }; _notiService.CreateNotification(notification); _notiService.SaveNotification(); var connections = _hubService.GetHubUserConnections(_ => _.UserId.Equals(_user.Id)); _hubContext.Clients.Clients(connections.Select(_ => _.Connection).ToList()) .SendAsync("Notify", JsonConvert.SerializeObject(notification.Adapt <NotificationVM>())); } return(Ok()); }