写一个详细的 netcore 动态进度条接口代码
时间: 2023-03-15 19:59:32 浏览: 63
```
下面是一个详细的netcore动态进度条接口代码:using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;namespace MyApp.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class ProgressController : ControllerBase
{
[HttpPost]
public async Task<IActionResult> Post([FromBody]Progress progress)
{
if(progress == null)
{
return BadRequest();
}
// In a real world application, you would use the Progress object to update the UI with the latest progress.
await Task.Delay(TimeSpan.FromSeconds(progress.Seconds));
return Ok(progress);
}
} public class Progress
{
public int Seconds { get; set; }
public string Message { get; set; }
}
}
```