Exemplo n.º 1
0
        public override async Task OnConnected(MessagesHub hub)
        {
            User user = await _usersRepository.GetByIdAsync(CancellationToken.None, Guid.Parse(_userInformationProvider.GetCurrentUserId()));

            await hub.Groups.Add(hub.Context.ConnectionId, user.Culture.ToString());

            await base.OnConnected(hub);
        }
        public override async Task<ChangeSetDto> Create(ChangeSetDto dto, CancellationToken cancellationToken)
        {
            ChangeSetDto insertedChangeSet = await base.Create(dto, cancellationToken);

            User user = await _usersRepository.GetByIdAsync(cancellationToken, Guid.Parse(_userInformationProvider.GetCurrentUserId()));

            _messageSender.SendMessageToGroups("ChangeSetHasBeenInsertedByUser", new { userName = user.UserName, title = insertedChangeSet.Title }, groupNames: new[] { user.Culture.ToString() });

            return insertedChangeSet;
        }
Exemplo n.º 3
0
        public async Task <UserSetting> GetCurrentUserSettingAsync(CancellationToken cancellationToken)
        {
            User user = await _usersRepository.GetByIdAsync(cancellationToken, Guid.Parse(_userInformationProvider.GetCurrentUserId()));

            UserSetting result = new UserSetting
            {
                Culture = user.Culture.ToString()
            };

            return(result);
        }