5

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)
G.S. Shekhawat
  • 339
  • 4
  • 13
  • im having the same issue. i was wandering whether its better to use model binding but thats seems to add more complexity for something that seems fairly standard. I cant help but thought i would share that i am struggling with a help page for multi part form data – Jonnymaboy Jan 07 '15 at 17:51
  • advice im really struggling with this. thanks – G.S. Shekhawat Jan 08 '15 at 14:58

0 Answers0