Home > Back-end >  My Swashbuckle.AspNetCore.Swagger have a problem
My Swashbuckle.AspNetCore.Swagger have a problem

Time:02-05

I have an API to convert currencies based on a local database. I create my controller, serive, repository and even though I can perform the query in the database I don't get the same result via API.I've already spent a few hours trying to solve this and nothing seems to work, here's the print.enter image description here. This case not is equals my problem because my swagger loads. This case not is equal my problem because i don't care about swagger color.

My controller:

[ApiController]
[Route("api/[Controller]")]
public class CurrencyController : ControllerBase
{
    [HttpGet]
    [Route("{code}")]
    public ObjectResult GetByCode([FromServices] CurrencyReadRepository repository, string code)
    {
        return Ok(repository.GetCurrency(code));
    }
...

CodePudding user response:

You can try on StartUp.cs:

services.AddTransient<CurrencyReadRepository>();
  • Related