Microsoft.AspNet.WebApi.Core提示在.NET 7不一定相容
想請要一下在.NET 7的情況下應該用哪一個library達到相同的功能
using Microsoft.AspNetCore.Mvc;
public class APIController : ControllerBase
{
[HttpGet]
[Route("api/GetCurrentTime")]
public IActionResult GetCurrentTime()
{
var currentTime = DateTime.Now;
var currentTimeString = currentTime.ToString("yyyy-MM-dd HH:mm:ss.fff");
var jsonResponse = $"{{\"time\": \"{currentTimeString}\"}}";
return Content(jsonResponse, "application/json");
}
}