示例#1
0
 public NotificationHub(IOnlineUsersRepository onlineUsers,
                        IFriendApiAccess friendApiAccess,
                        IMessageApiAccess messageApiService,
                        IPostApiAccess postApiAccess,
                        INotificationApiAccess notificationApiAccess,
                        ILogger <NotificationHub> logger)
 {
     _onlineUsers           = onlineUsers;
     _friendApiAccess       = friendApiAccess;
     _messageApiService     = messageApiService;
     _postApiAccess         = postApiAccess;
     _notificationApiAccess = notificationApiAccess;
     _logger = logger;
 }
 public FriendsController(IHttpContextAccessor httpContextAccessor,
                          IPostApiAccess postApiAccess,
                          INotificationApiAccess notificationApiAccess,
                          IUserApiAccess userApiAccess,
                          IFriendApiAccess friendApiAccess,
                          ILogger <FriendsController> logger,
                          IMapper mapper)
 {
     _postApiAccess         = postApiAccess;
     _notificationApiAccess = notificationApiAccess;
     _userApiAccess         = userApiAccess;
     _friendApiAccess       = friendApiAccess;
     _logger = logger;
     _mapper = mapper;
     _userApiAccess.AddUserIfNotExist(httpContextAccessor.HttpContext.User).GetAwaiter();
     _userId = httpContextAccessor.HttpContext.User.Claims.FirstOrDefault(x => x.Type == ClaimTypes.NameIdentifier).Value;
 }