コード例 #1
0
        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
0
 protected static void Because_of()
 {
     client = new HttpClient();
     var uri = ServiceUrl["LegalEntity"] + legalentity.Id + "/Mapping/" + legalentity.Mappings[0].Id;
     response = client.Delete(uri);
 }
コード例 #3
0
 protected static void Because_of()
 {
     client = new HttpClient();
     var uri = ServiceUrl["Location"] + location.Id + "/Mapping/" + location.Mappings[0].Id;
     response = client.Delete(uri);
 }
コード例 #4
0
 protected static void Because_of()
 {
     client = new HttpClient();
     var uri = ServiceUrl["Exchange"] + exchange.Id + "/Mapping/" + exchange.Mappings[0].Id;
     response = client.Delete(uri);
 }
コード例 #5
0
 protected static void Because_of()
 {
     client = new HttpClient();
     var uri = ServiceUrl["PartyRole"] + partyrole.Id + "/Mapping/" + partyrole.Mappings[0].Id;
     response = client.Delete(uri);
 }
コード例 #6
0
 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)));
 }