Web API - Need a way to return Multipart Form data in response

I am currently building a web service to replace one of the legacy application and the web service response has to be matching to the existing service. I am currently using .Net 5.0 Core ASP.Net web API.

The request format for the service is

/DocuemntService?info&pVersion=0046&contRep=Z8&docId=%7BDCC15450-79FE-45BF-AC73-250544C8F8EE%7D&accessMode=r

Response Expected : This was the raw output captured from legacy service (Note this only returns document info in headers and not the document)

HTTP/1.0 200 OK
X-DocServiceInfoS: RSP-ID -431702117 begin
Connection: close
Date: Fri Jan 29 15:15:25 WST 2021
Server: Document Service - HTTP Interface/1.0.0
Content-Length: 258
Content-Type: multipart/form-data; boundary=NEXT_COMPONENT
X-dateC: 20160120
X-timeC: 034143
X-dateM: 20160120
X-timeM: 034143
X-numComps: 1
X-contRep: Z8
X-docId: {DCC15450-79FE-45BF-AC73-250544C8F8EE}
X-docStatus: online
X-DocServiceInfoE: RSP-ID -431702117 end


--NEXT_COMPONENT
Content-Length: 0
Content-Type: image/tiff
X-Content-Length: 54138
X-compId: data
X-compDateC: 20160120
X-compTimeC: 034143
X-compDateM: 20160120
X-compTimeM: 034143
X-compStatus: online
X-pVersion: 0045


--NEXT_COMPONENT--

So far I used the following code from Controller to return the multipart form data, but it pushes json file and it doesnt return anything similar to above.

[ProducesResponseType(StatusCodes.Status200OK)]
        [ProducesResponseType(StatusCodes.Status400BadRequest)]        
        [ProducesResponseType(StatusCodes.Status500InternalServerError)]
        [HttpGet]                     
        public async Task<HttpResponseMessage> DocumentServer([FromQuery] DocumentInfoRequest requestInfo)
        {
            HttpResponseMessage ApiResponse= new HttpResponseMessage(HttpStatusCode.OK);
            IQueryCollection queryStringParams = ControllerContext.HttpContext.Request.Query;
            Response.ContentType=
            if (Request.Query.Keys.Count > 0)
            {
                //First query parameter determines the operation
                String operation = queryStringParams.Keys.First();
                switch (operation)
                {
                    case "serverInfo":
                        ApiResponse=await ServerInfo2(requestInfo, ApiResponse);                        
                        break;
                    case "info":
                        DocumentInfo doc = DocumentInfo(requestInfo, Response);
                        Response.Headers.Add(AppConstants.XCSINFOS_BEGIN);
                        Response.Headers.Add(AppConstants.DATE);
                        Response.Headers.Add(AppConstants.XCSINFOS_END);                                                
                        using (MultipartFormDataContent multipartForm =   new MultipartFormDataContent("NEXT_COMPONENT"))
                        {
                            multipartForm.Headers.Add("X-docId", requestInfo.DocId);
                            multipartForm.Headers.Add("X-compId", doc.CompId);                            
                            Response.Headers.Add(new KeyValuePair<string, Microsoft.Extensions.Primitives.StringValues>("X-docId", requestInfo.DocId));
                            Response.Headers.Add(new KeyValuePair<string, Microsoft.Extensions.Primitives.StringValues>("X-compId", doc.CompId));
                            await WriteData(Response, "Test");
                            ApiResponse.Content = multipartForm;                                                       
                        };
                        break;
                    case "get":
                        await DownloadDocument(requestInfo, Response);
                        break;
                    case "create":
                        break;
                }
            }
            return ApiResponse;
        }

I am not sure whether I am following the right approach? The above code is only sample to see whether it returns few parameters and if it works my plan is to develop to return all document info and in the Get request, return the document itself.

I primarily have the java background and tried to implement this in Web API because .Net is preferred for this application deployment.

I already wasted quite a lot of time on this and I couldn't find any relevant article to solve this problem.

Any help or direction would be much appreciated?

Thanks