コード例 #1
0
 public IActionResult Notifications([FromQuery] int skip, [FromQuery] int take)
 {
     return(withUser(Request, user => {
         var result = _notificationProviderService.GetUserNotifications(user.Id, skip, take);
         return new JsonResult(result);
     }));
 }
コード例 #2
0
        public override async Task OnConnectedAsync()
        {
            var user = (UserDto)this.Context.GetHttpContext().Items["user"];

            _manager.RegisterConnection(user.Id, Context.ConnectionId);

            var notifications = _notificationProviderService
                                .GetUserNotifications(user.Id, 0, 20)
                                .ToArray();

            await base.OnConnectedAsync();

            await SendInitialNotifications(notifications);
        }