当前位置: 首页>>代码示例>>C#>>正文


C# UserService.ApproveFriendRequest方法代码示例

本文整理汇总了C#中UserService.ApproveFriendRequest方法的典型用法代码示例。如果您正苦于以下问题:C# UserService.ApproveFriendRequest方法的具体用法?C# UserService.ApproveFriendRequest怎么用?C# UserService.ApproveFriendRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserService的用法示例。


在下文中一共展示了UserService.ApproveFriendRequest方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

        static void Main(string[] args)
        {
            UserService se = new UserService(new UserRepository());
            se.ApproveFriendRequest(new ChatAppService.Models.FriendRequest()
            {
                FromUserId = "89",
                ToUserId ="0"
            });

            var jGcmData = new JObject();
            var jData = new JObject();

            jData.Add("message", MESSAGE);
            jGcmData.Add("to", "/topics/global");
            jGcmData.Add("data", jData);

            var url = new Uri("https://gcm-http.googleapis.com/gcm/send");
            try
            {
                using (var client = new HttpClient())
                {
                    client.DefaultRequestHeaders.Accept.Add(
                        new MediaTypeWithQualityHeaderValue("application/json"));

                    client.DefaultRequestHeaders.TryAddWithoutValidation(
                        "Authorization", "key=" + API_KEY);

                    Task.WaitAll(client.PostAsync(url,
                        new StringContent(jGcmData.ToString(), Encoding.Default, "application/json"))
                            .ContinueWith(response =>
                            {
                                Console.WriteLine(response);
                                Console.WriteLine("Message sent: check the client device notification tray.");
                                Console.ReadLine();

                            }));

                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Unable to send GCM message:");
                Console.Error.WriteLine(e.StackTrace);
            }
        }
开发者ID:perumalsamya,项目名称:XamarinDevelopment,代码行数:45,代码来源:Program.cs

示例2: linkBtnAddFriend_Click

    protected void linkBtnAddFriend_Click(object sender, EventArgs e)
    {
        try
        {
            using (UserService service = new UserService())
            {
                LinkButton button = ((LinkButton)sender);

                if (button.CommandName == "Approve")
                {
                    FriendRequest request = new FriendRequest();
                    request.FromUserId = button.CommandArgument;
                    request.ToUserId = LoggedUser.ID;
                    service.ApproveFriendRequest(request);

                    FailureText.Text = "Approved Successfully..";
                }
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
开发者ID:perumalsamya,项目名称:XamarinDevelopment,代码行数:24,代码来源:ReceivedRequests.aspx.cs


注:本文中的UserService.ApproveFriendRequest方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。