Ejemplo n.º 1
0
        public void BeginListen(string channelId)
        {
            var channelGuid = default(Guid);
            if (Guid.TryParse(channelId, out channelGuid) == false) return;

            var db = new TellMeWYSDB();
            var channel = db.Channels.Find(channelGuid);
            if (channel == null) return;

            var account = this.Context.User.ToAccount(db);
            if (channel.ChannelMembers.Any(_ => _.AccountId == account.Id) == false) return;

            this.Groups.Add(this.Context.ConnectionId, channelGuid.ToString("N"));
        }
Ejemplo n.º 2
0
 public static Account ToAccount(this IPrincipal principal, TellMeWYSDB db)
 {
     var account = db.Accounts.FirstOrDefault(_ => _.UniqueIdInProvider == principal.Identity.Name);
     return account;
 }