Beispiel #1
0
        public async Task Command(string fight, string userName, string command)
        {
            if (!Guid.TryParseExact(fight, "N", out var fightGuid) && !Guid.TryParse(fight, out fightGuid))
            {
                return;
            }

            await _usersStorage.TouchAsync(fightGuid, Context.ConnectionId);

            await _dataContext.Commands.AddAsync(new CommandEntity()
            {
                UserName    = userName,
                DateCreated = DateTimeOffset.UtcNow,
                Fight       = fightGuid,
                Body        = command
            });

            await _dataContext.SaveChangesAsync();

            await Clients.OthersInGroup(fight).SendAsync("command", new CommandData()
            {
                Body   = command,
                UserId = Context.ConnectionId
            });
        }
Beispiel #2
0
        public async Task Command(string fight, string userName, string commandId)
        {
            if (!Guid.TryParseExact(fight, "N", out var fightGuid) && !Guid.TryParse(fight, out fightGuid))
            {
                return;
            }

            await _usersStorage.TouchAsync(fightGuid, Context.ConnectionId);

            await Clients.OthersInGroup(fight).SendAsync("command", new CommandData()
            {
                Id     = commandId,
                UserId = Context.ConnectionId
            });
        }