rickbeerendonk_aspnet-examples/09 - MVC - Web API/b. Swagger/Controllers/MainController.cs
using Microsoft.AspNetCore.Mvc;

namespace MvcWebApi_Swagger.Controllers;

[ApiController]
[Route("api/[controller]")]
public class MainController : ControllerBase
{
  [HttpGet]
  // 4. Use Swagger (200 is actually default)
  [ProducesResponseType(StatusCodes.Status200OK)]
  public ActionResult<IEnumerable<string>> Get()
  {
    return Ok(new List<string> { "one", "two", "three" });
  }

  [HttpPost]
  // 5. Use Swagger
  [ProducesResponseType(StatusCodes.Status400BadRequest)]
  public IActionResult Post()
  {
    return BadRequest();
  }
}