コード例 #1
0
ファイル: Group.cs プロジェクト: CerebralUnit/SafehouseChat
        public async Task <IActionResult> Index(string id, string channelId)
        {
            var user = await users.GetUser(User.Identity.Name);

            var thisGroup = await groups.GetChatGroup(id);

            ChatGroupChannel channel = null;

            if (channelId == null)
            {
                channel = await groups.GetChannelDetailsByName(id, "general");
            }
            else
            {
                channel = await groups.GetChannelDetails(channelId);
            }

            var userChatGroup = user.ChatGroups?.FirstOrDefault(x => x.Id == thisGroup.Id);

            userChatGroup.IsCurrent = true;

            var groupChannel = thisGroup.Channels.FirstOrDefault(x => x.Id == channel.Id);

            groupChannel.IsCurrent = true;

            ViewData["ChannelId"] = channel.Id;
            ViewData["GroupId"]   = thisGroup.Id;
            ViewBag.User          = user;
            ViewBag.Channel       = channel;
            ViewBag.Group         = thisGroup;

            return(View("Chat"));
        }
コード例 #2
0
 public async Task <string> CreateChannel(ChatGroupChannel channel)
 {
     return(await channels.Create(channel));
 }