本文整理汇总了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()));
}
}
}
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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)));
}