I have a controller endpoint as shown here which accepts an ExamCreateDTO from the form.
public async Task<ActionResult<IResponseData<uint>>> Create([FromForm] ExamCreateDTO examCreateDto)
These are the simplified ExamCreateDTO and ReservationQuota classes:
public class ExamCreateDTO : NamedObjectDTO
{
public Scope Scope { get; set; }
public Mode Mode { get; set; }
public List<ReservationQuota> ReservationQuota { get; set; }
public IEnumerable<IFormFile>? SampleFormFiles { get; set; }
}
public class ReservationQuota
{
public string Category { get; set; }
public short Reservation { get; set; }
}
I am trying to send the request by filling the form in Swagger. I am getting all fields correctly including form files in ExamCreateDTO, except ReservationQuota.
ReservationQuota count is 0, even though I am sending data in Swagger.
When I inspect HttpContext.Request.Form keys and store data for ReservationQuota is proper like this:
{
[ReservationQuota, { { "category": "General", "reservation": 50 } } ]
}
Stuck with this for quite some time. Any help/hint is greatly appreciated.
