I create a .Net Core API ( I use swagger with it).
I create a controller in order to upload a picture to link it to an item.
.cs :
[HttpPut("[Action]/{id}")]
public async Task<ActionResult> Link(int id, IFormFile file)
{
var item = await _context.Item.FirstOrDefaultAsync(t => t.Id == id);
if (item == null)
{
return BadRequest("item null");
}
using (var memoryStream = new MemoryStream())
{
await file.CopyToAsync(memoryStream);
// code to link
return Ok(file);
}
}
My issue is if I want to test to know if it works, I have to use postman but I want to test it in my api.
A solution exist for my issue ? For the moment it look like that :
