Exemple #1
0
        public async Task EnterMatch(string connectionId, string id)
        {
            var method = "EnterMatch";

            try
            {
                var result = false;
                var user   = GetUserById(id);
                if (user != null)
                {
                    result = _matchService.Enter(user);
                }

                if (result)
                {
                    await _context.Clients(connectionId).SendCoreAsync(method, PayloadPack.Success(new SC_EnterMatch()
                    {
                        Id = id,
                    }));
                }
                else
                {
                    await _context.Clients(connectionId).SendCoreAsync(method, PayloadPack.Fail(PayloadCode.Failure));
                }
            }
            catch (Exception ex)
            {
                await _context.Clients(connectionId).SendCoreAsync(method, PayloadPack.Error(ex));
            }
        }