public ApiResult NewCount() { string json = new JWT(_httpContext).ResolveToken(); UserModel userModel = JsonHelper.DeserializeObject <UserModel>(json); int count = _tidingsService.SelectCountByAccount(userModel.Account); return(ApiResult.Success(count)); }
public async Task NewsCount(string account) { IReadOnlyList <string> connectionIds = (IReadOnlyList <string>)_singalrSvc.GetConnectionIds(account); int count = _tidingsService.SelectCountByAccount(account); Message sendMessage = new Message(); sendMessage.Data = count; await _hubContext.Clients.Clients(connectionIds).SendClientMessage(sendMessage); }