public ActionResult SendNotification(string title, string message, Guid user, NotificationType type) { var returnModel = new SendNotificationReturnModel { id = Guid.NewGuid(), idUser = user, title = title, message = message, type = type }; if (UserHandler.ConnectedIds.Contains(returnModel.idUser.ToString())) { _context.Clients.Client(returnModel.idUser.ToString()) .notificationReceived( returnModel.id, returnModel.title, returnModel.message, returnModel.type); } else { returnModel.ErrorMessage = "User is not connected anymore"; } return(new JsonResult { Data = returnModel }); }
public SendNotificationReturnModel SendNotification(string title, string message, Guid user, NotificationType type) { var retorno = new SendNotificationReturnModel { id = Guid.NewGuid(), title = title, message = message, type = type, idUser = user }; if (UserHandler.ConnectedIds.Contains(user.ToString())) { Clients.Client(retorno.idUser.ToString()) .notificationReceived( retorno.id, retorno.title, retorno.message, retorno.type); return(retorno); } else { retorno.ErrorMessage = "User is not connected"; return(retorno); } }