コード例 #1
0
ファイル: GrpcClient.cs プロジェクト: zhj149/ContainerBase
 public void UseClient(string addr, int port)
 {
     if (Client != null)
     {
         Client.WithHost($"{addr}:{port}");
     }
     else
     {
         Core.Channel channel = new Core.Channel($"{addr}:{port}", Core.ChannelCredentials.Insecure);
         Client = new Grpcconnect.Standard.gConnect.gConnectClient(channel);
     }
 }
コード例 #2
0
        public async Task <IActionResult> New(ChannelModel channel)
        {
            var newChannel = new Core.Channel()
            {
                Name           = channel.ChannelName,
                Picture        = channel.ChannelPicture ?? "",
                Creator        = User.Identity.Name,
                ParticipantIds = new List <string>()
                {
                    User.Identity.Name
                }
            };

            var newChannelId = await channels.Create(newChannel);

            if (!String.IsNullOrWhiteSpace(newChannelId))
            {
                return(Redirect("channel/" + newChannelId));
            }

            return(View());
        }