Exemplo n.º 1
0
 public void Deallocate(string propertyReference)
 {
     var propertyAllocation = new PropertyAllocation
     {
         ItemReference = string.Empty,
         ItemType = ItemType.Property,
         Url = _allocationSettings.PropertyItemUrl + propertyReference
     };
     _allocationProvider.Deallocate(propertyAllocation);
 }
Exemplo n.º 2
0
 public void AllocateSubmittedProperty(string propertyReference)
 {
     var propertyAllocation = new PropertyAllocation
     {
         ItemReference = string.Empty,
         ItemType = ItemType.LandlordProperty,
         Url = _allocationSettings.PropertyItemUrl + propertyReference
     };
     _allocationProvider.Allocate(propertyAllocation);
 }
        private static void PostAllocation(PropertyAllocation propertyAllocation, string url,
            IApiAuthenticationSettings apiAuthenticationSettings)
        {
            var restClient = new RestClient(url)
            {
                Authenticator = new HttpBasicAuthenticator(
                    apiAuthenticationSettings.AuthorisedApiCredentials.FirstOrDefault()?.AppId,
                    apiAuthenticationSettings.AuthorisedApiCredentials.FirstOrDefault()?.ApiKey)
            };

            var request = new RestRequest {RequestFormat = DataFormat.Json, Method = Method.POST};

            if(propertyAllocation != null)
                request.AddBody(propertyAllocation);

            var x = restClient.Execute(request);
        }
 public void Deallocate(PropertyAllocation propertyAllocation)
 {
     var url = $"{_allocationSettings.AllocationServiceUrl}allocation/item/deallocate?url={propertyAllocation.Url}";
     PostAllocation(null, url, _apiAuthenticationSettings);
 }
 public void Allocate(PropertyAllocation propertyAllocation)
 {
     var url = _allocationSettings.AllocationServiceUrl + "allocation/allocate/";
     PostAllocation(propertyAllocation, url, _apiAuthenticationSettings);
 }