コード例 #1
0
 public HomeController(OnlineChatDBContext context, IHomeService service, IHubContext <HomeHub> chat, IChatService chatService) //
 {
     _context     = context;
     _homeService = service;
     _chat        = chat;
     _chatService = chatService;
 }
コード例 #2
0
 public ChatService(OnlineChatDBContext context, IHttpContextAccessor httpContextAccessor, IMapper mapper, IHomeService homeService)
 {
     _context             = context;
     _httpContextAccessor = httpContextAccessor;
     _mapper      = mapper;
     _homeService = homeService;
 }
コード例 #3
0
        public async Task <IActionResult> SendMessageAsync(int groupId, string message, string groupName, string connectionId, [FromServices] OnlineChatDBContext context)
        {
            var messageView = await _chatService.ReturnSendedMessageAsync(groupId, message);

            await _chat.Clients.Group(groupName)
            .SendAsync("ReceiveMessage", messageView, connectionId, groupId);

            await NotificateUsers(groupId, connectionId, messageView);

            return(Ok());
        }
コード例 #4
0
 public HomeService(OnlineChatDBContext context, IHttpContextAccessor httpContextAccessor, IMapper mapper)
 {
     _context             = context;
     _httpContextAccessor = httpContextAccessor;
     _mapper = mapper;
 }
コード例 #5
0
 public ChatHub(OnlineChatDBContext context)
 {
     _context = context;
 }
コード例 #6
0
 public HomeHub(OnlineChatDBContext context)
 {
     _context = context;
 }
コード例 #7
0
 public ChatViewComponent(OnlineChatDBContext context)
 {
     _context = context;
 }