I have an Entity that contain some images and I want to update it using HttpPatch method.
To create a new Style I use this method:
[HttpPost]
public async Task<IActionResult> CreateStyleAsync([FromForm] StyleFiles styleFiles, [FromForm] StyleDTO style)
Now I'm trying to create a method to update this Style using the HttpPatch method. I tried this but there is no option to upload the file on Swagger:
[HttpPatch("{styleId}")]
public async Task<IActionResult> PatchStyleAsync([FromForm] StyleFiles styleFiles, Guid styleId, [FromBody] JsonPatchDocument styleDto)
This is what I see on Swagger: Patch method on Swagger
This is the DTO:
public class StyleDTO
{
public Guid Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public string PreviewImage { get; set; }
}
And this the StyleFiles class:
public class StyleFiles
{
public IFormFile Image { get; set; }
}
I'm thinking to make two separate endpoints, one for updating the File and another one for updating the entity itself. But I would like to not do that.