mirror of
https://gitlab.com/Hukuta47/cartrix.git
synced 2026-12-05 04:20:55 +00:00
27 lines
836 B
C#
27 lines
836 B
C#
using CartriX.Api.Interfaces;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace CartriX.Api.Controllers
|
|
{
|
|
[Route("api/[controller]")]
|
|
[ApiController]
|
|
public class NetworkController : ControllerBase
|
|
{
|
|
private readonly INetworkService _networkService;
|
|
public NetworkController(INetworkService networkService)
|
|
{
|
|
_networkService = networkService;
|
|
}
|
|
[HttpGet(nameof(GetIpAddress))]
|
|
public async Task<IActionResult> GetIpAddress([FromQuery] string hostname)
|
|
{
|
|
return Ok(await _networkService.GetIpAddressAsync(hostname));
|
|
}
|
|
[HttpGet(nameof(Ping))]
|
|
public async Task<IActionResult> Ping([FromQuery] string IpAddressOrHostname)
|
|
{
|
|
return Ok(await _networkService.Ping(IpAddressOrHostname));
|
|
}
|
|
}
|
|
}
|