C
C#12mo ago
Dharmang

Web API - Get Payload in body as well as the uploaded File using Ardalis Endpoints

How can I fetch the uploaded file as FormFile and also accept the body payload using FromBody. Example Request.cs attached. Also what should be the root annotation in the HandleAsync() function?
public override async Task<ActionResult<int>> HandleAsync([FromForm] DocumentTemplateDto documentTemplateDto, CancellationToken cancellationToken = default)
public override async Task<ActionResult<int>> HandleAsync([FromForm] DocumentTemplateDto documentTemplateDto, CancellationToken cancellationToken = default)
No description
5 Replies
Dharmang
DharmangOP12mo ago
@ardalis can you help with this... not able to find anything related to this?
ardalis
ardalis12mo ago
Are you able to do it in a plain controller? If not then I’d work on that first. If so can you show an example with that ideally as a new GitHub issue? Thanks!
Dharmang
DharmangOP12mo ago
Sure, I actually am not a c# developer, just started coding it in recently and loved the endpoint's package. So not sure what you mean by plain controller. Here I am sharing the MRP and the issue while conversion.
Dharmang
DharmangOP12mo ago
Also have added comments on what i needed to do in the project 🙂
Dharmang
DharmangOP12mo ago
GitHub
Get Payload in body as well as the uploaded File · Issue #204 · ard...
NuGet Package Version: 4.1.0 .NET SDK Version: 8 Issue is combining FromForm and FromBody not working as expected. Unable to upload file and other properties together. (Note one property type is Js...
Want results from more Discord servers?
Add your server