Example #1
0
        public async Task <ActionResult <RegisterChannelResult> > CreateChannel([FromBody] RegisterChannel channel)
        {
            RegisterChannelResult c = this.Manager.CreateChannelView(channel, this.Identity);

            await this.HubContext.Clients.AllExcept(new string[] { Identity.ID }).SendAsync("onNewChannel", c);

            return(this.Ok(c));
        }
Example #2
0
        public RegisterChannelResult CreateChannelView(RegisterChannel channel, UserIdentity identity)
        {
            RegisterChannelResult result = new RegisterChannelResult();
            Channel c = this.CreateChannel(channel.IdForum, new Channel {
                Name = channel.NameChannel
            }, identity);

            result.Channel = c?.ToChannelView();
            result.Forum   = this.Manager.GetForumById(channel.IdForum).ToViewForum();
            result.UserId  = identity.ID;

            return(result);
        }