问题
Please help me to add a multipart/form data parameter on api help page.
I'm using Microsoft.AspNet.WebApi.HelpPage.VB 5.2.2.
I want to add CustomerName, fdStreet1, fdStreet2 parameter information on to the api help page. How can I do this?
Here's what I have so far.
<HttpPost> _
<ResponseType(GetType(TestModel))> _
<Route("TestAdd")> _
Public Function TestAdd() As IHttpActionResult
Dim ServerUploadFolder = HttpContext.Current.Server.MapPath("~/Uploaded/")
If Not Request.Content.IsMimeMultipartContent Then
Throw New HttpResponseException(Request.CreateResponse(HttpStatusCode.UnsupportedMediaType))
End If
Dim streamProvider = New CustomMultipartFormDataStreamProvider(ServerUploadFolder)
Request.Content.ReadAsMultipartAsync(streamProvider)
'Read form data
Dim _testModel As New TestModel
_testModel.fdCustomerName = streamProvider.FormData("CustomerName")
_testModel.fdStreet1 = streamProvider.FormData("fdStreet1")
_testModel.fdStreet2 = streamProvider.FormData("fdStreet2")
Return Json(_testModel)
来源:https://stackoverflow.com/questions/27819829/how-to-add-multipart-form-data-parameter-on-webapi-help-page