I'm new to asp.net. I want to create a web sercive using asp.net. I crated a project using this tutorial.
I have these class :
public class QRCodeItem
{
[Key]
public Byte Version { get; set; }
public int PrintPPI { get; set; }
public int CellSize { get; set; }
}
[Route("api/QRCode")]
[ApiController]
public class QRCodeController : ControllerBase
{
[HttpGet]
[Route("/CreateCode/{Version}/{PrintPPI}/{CellSize}")]
public async Task<ActionResult<IEnumerable<QRCodeItem>>> CreateCode(Byte Version = 1, int PrintPPI = 300, int CellSize = 5)
{
return await _context.QRCodeItems.ToListAsync();
}
[HttpGet]
public async Task<ActionResult<IEnumerable<QRCodeItem>>> GetQRCodeItems()
{
return await _context.QRCodeItems.ToListAsync();
}
}
I try to acces to CreateCode with this url :
https://localhost:44349/api/CreateCode?Version=1&PrintPPI=300&CellSize=2
But I'm unable to call the method. How can I call CreateCode using this url ? I can change the method, but not the url.
The url is working with :
https://localhost:44349/api/QRCode
Method GetQRCodeItems is called.