2023-04-14 22:57:48 +08:00

29 lines
687 B
C#

using ClassLibrary1;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using WebMVCApi.Services;
namespace DIWebApi.Controllers
{
[Route("api/")]
[ApiController]
public class TestController : ControllerBase
{
private readonly CalculateService calculate;
public TestController(CalculateService calculate) {
this.calculate = calculate;
}
[HttpGet("Get")]
public int Get([FromServices] Class1 class1,int i1 ,int i2)
{
return class1.Add(i1,i2);
}
[HttpGet("GetCount")]
public int GetCount()
{
return calculate.Count;
}
}
}