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


C# HttpClient.Delete方法代码示例

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


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

示例1: DeleteScreenshot

        public void DeleteScreenshot(string idOfScreenshotToDelete) {
            string serviceRoot = _orchardServices.WorkContext.CurrentSite.As<GallerySettingsPart>().ServiceRoot;
            string accessKey = _userkeyService.GetAccessKeyForUser(_authenticationService.GetAuthenticatedUser().Id).AccessKey.ToString();
            string uri = string.Format("{0}/{1}/{2}", ServiceConstants.ScreenshotServiceName, accessKey, idOfScreenshotToDelete);

            using (var client = new HttpClient(serviceRoot)) {
                using (HttpResponseMessage response = client.Delete(uri)) {
                    if (response.StatusCode != HttpStatusCode.OK) {
                        _orchardServices.Notifier.Error(T("Could not delete screenshot. {0}", response.ReadContentAsStringWithoutQuotes()));
                    }
                }
            }
        }
开发者ID:NickAndersonX,项目名称:xodb,代码行数:13,代码来源:GalleryScreenshotService.cs

示例2: Because_of

 protected static void Because_of()
 {
     client = new HttpClient();
     var uri = ServiceUrl["LegalEntity"] + legalentity.Id + "/Mapping/" + legalentity.Mappings[0].Id;
     response = client.Delete(uri);
 }
开发者ID:RaoulHolzer,项目名称:EnergyTrading-MDM-Sample,代码行数:6,代码来源:success.cs

示例3: Because_of

 protected static void Because_of()
 {
     client = new HttpClient();
     var uri = ServiceUrl["Location"] + location.Id + "/Mapping/" + location.Mappings[0].Id;
     response = client.Delete(uri);
 }
开发者ID:RaoulHolzer,项目名称:EnergyTrading-MDM-Sample,代码行数:6,代码来源:success.cs

示例4: Because_of

 protected static void Because_of()
 {
     client = new HttpClient();
     var uri = ServiceUrl["Exchange"] + exchange.Id + "/Mapping/" + exchange.Mappings[0].Id;
     response = client.Delete(uri);
 }
开发者ID:RaoulHolzer,项目名称:EnergyTrading-MDM-Sample,代码行数:6,代码来源:success.cs

示例5: Because_of

 protected static void Because_of()
 {
     client = new HttpClient();
     var uri = ServiceUrl["PartyRole"] + partyrole.Id + "/Mapping/" + partyrole.Mappings[0].Id;
     response = client.Delete(uri);
 }
开发者ID:RaoulHolzer,项目名称:EnergyTrading-MDM-Sample,代码行数:6,代码来源:success.cs

示例6: DeletePackage

 private void DeletePackage(string packageId, string packageVersion, string deleteUri) {
     string serviceRoot = _orchardServices.WorkContext.CurrentSite.As<GallerySettingsPart>().ServiceRoot;
     using (var client = new HttpClient(serviceRoot)) {
         using (HttpResponseMessage response = client.Delete(deleteUri)) {
             if (response.StatusCode != HttpStatusCode.OK) {
                 _orchardServices.Notifier.Error(T(response.ReadContentAsStringWithoutQuotes()));
             } else {
                 PackagePart partToDelete = _packageService.Get(p => p.PackageID == packageId && p.PackageVersion == packageVersion, true)
                     .SingleOrDefault();
                 if (partToDelete != null) {
                     _packageService.Delete(packageId, packageVersion);
                     _packageService.ResetRecommendedVersionForPackage(partToDelete);
                 }
             }
         }
     }
     _orchardServices.Notifier.Information(T(string.Format("Package {0}, version {1}, has been deleted.", packageId, packageVersion)));
 }
开发者ID:NickAndersonX,项目名称:xodb,代码行数:18,代码来源:GalleryPackageService.cs


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