public async Task <IActionResult> PlanBuildingUnit( [FromBody] PlanBuildingUnitRequest planBuildingUnitRequest, [FromServices] IActionContextAccessor actionContextAccessor, [FromServices] ProblemDetailsHelper problemDetailsHelper, [FromServices] PlanBuildingUnitToggle planBuildingUnitToggle, CancellationToken cancellationToken = default) { if (!planBuildingUnitToggle.FeatureEnabled) { return(NotFound()); } var contentFormat = DetermineFormat(actionContextAccessor.ActionContext); IRestRequest BackendRequest() => CreateBackendRequestWithJsonBody( "gebouweenheden/acties/plannen", planBuildingUnitRequest, Method.POST); var value = await GetFromBackendWithBadRequestAsync( contentFormat.ContentType, BackendRequest, CreateDefaultHandleBadRequest(), problemDetailsHelper, cancellationToken : cancellationToken); return(new BackendResponseResult(value, BackendResponseResultOptions.ForBackOffice())); }
public async Task <IActionResult> ProposeAddress( [FromBody] AddressProposeRequest addressProposeRequest, [FromServices] IActionContextAccessor actionContextAccessor, [FromServices] ProblemDetailsHelper problemDetailsHelper, [FromServices] ProposeAddressToggle proposeAddressToggle, CancellationToken cancellationToken = default) { if (!proposeAddressToggle.FeatureEnabled) { return(NotFound()); } var contentFormat = DetermineFormat(actionContextAccessor.ActionContext); IRestRequest BackendRequest() => CreateBackendRequestWithJsonBody( ProposeAddressRoute, addressProposeRequest, Method.POST); var value = await GetFromBackendWithBadRequestAsync( contentFormat.ContentType, BackendRequest, CreateDefaultHandleBadRequest(), problemDetailsHelper, cancellationToken : cancellationToken); return(new BackendResponseResult(value, BackendResponseResultOptions.ForBackOffice())); }
public async Task <IActionResult> ApproveStreetName( [FromRoute] int objectId, [FromServices] IActionContextAccessor actionContextAccessor, [FromServices] ProblemDetailsHelper problemDetailsHelper, [FromServices] ApproveStreetNameToggle approveStreetNameToggle, [FromHeader(Name = HeaderNames.IfMatch)] string?ifMatch, CancellationToken cancellationToken = default) { if (!approveStreetNameToggle.FeatureEnabled) { return(NotFound()); } var contentFormat = DetermineFormat(actionContextAccessor.ActionContext); IRestRequest BackendRequest() => CreateBackendPutRequest(objectId, ifMatch); var value = await GetFromBackendWithBadRequestAsync( contentFormat.ContentType, BackendRequest, CreateDefaultHandleBadRequest(), problemDetailsHelper, cancellationToken : cancellationToken); return(new BackendResponseResult(value, BackendResponseResultOptions.ForBackOffice())); }
public async Task <IActionResult> CorrectPositionAddress( [FromRoute] int objectId, [FromBody] AddressCorrectPositionRequest addressCorrectPositionRequest, [FromServices] IActionContextAccessor actionContextAccessor, [FromServices] ProblemDetailsHelper problemDetailsHelper, [FromServices] CorrectPositionAddressToggle correctPositionAddressToggleToggle, [FromHeader(Name = HeaderNames.IfMatch)] string?ifMatch, CancellationToken cancellationToken = default) { if (!correctPositionAddressToggleToggle.FeatureEnabled) { return(NotFound()); } var contentFormat = DetermineFormat(actionContextAccessor.ActionContext); IRestRequest BackendRequest() { var request = new RestRequest(CorrectPositionRoute, Method.POST) .AddParameter( "application/json; charset=utf-8", JsonConvert.SerializeObject(addressCorrectPositionRequest), ParameterType.RequestBody) .AddParameter( "objectId", objectId, ParameterType.UrlSegment); if (ifMatch is not null) { request.AddHeader(HeaderNames.IfMatch, ifMatch); } return(request); } var value = await GetFromBackendWithBadRequestAsync( contentFormat.ContentType, BackendRequest, CreateDefaultHandleBadRequest(), problemDetailsHelper, cancellationToken : cancellationToken); return(new BackendResponseResult(value, BackendResponseResultOptions.ForBackOffice())); }
public async Task <IActionResult> NotRealizeBuildingUnit( [FromRoute] int objectId, [FromServices] IActionContextAccessor actionContextAccessor, [FromServices] ProblemDetailsHelper problemDetailsHelper, [FromServices] RealizeBuildingUnitToggle notRealizeBuildingUnitToggle, [FromHeader(Name = HeaderNames.IfMatch)] string?ifMatch, CancellationToken cancellationToken = default) { if (!notRealizeBuildingUnitToggle.FeatureEnabled) { return(NotFound()); } var contentFormat = DetermineFormat(actionContextAccessor.ActionContext); IRestRequest BackendRequest() { var request = new RestRequest("gebouweenheden/{persistentLocalId}/acties/nietrealiseren", Method.POST); request.AddParameter("persistentLocalId", objectId, ParameterType.UrlSegment); if (ifMatch is not null) { request.AddHeader(HeaderNames.IfMatch, ifMatch); } return(request); } var value = await GetFromBackendWithBadRequestAsync( contentFormat.ContentType, BackendRequest, CreateDefaultHandleBadRequest(), problemDetailsHelper, cancellationToken : cancellationToken); return(new BackendResponseResult(value, BackendResponseResultOptions.ForBackOffice())); }