mirror of
https://gitlab.com/Hukuta47/cartrix.git
synced 2026-12-05 04:20:55 +00:00
27 lines
842 B
C#
27 lines
842 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(GetHostname))]
|
|
public async Task<IActionResult> GetHostname([FromQuery] string ipAddress)
|
|
{
|
|
return Ok(await _networkService.GetHostnameAsync(ipAddress));
|
|
}
|
|
[HttpGet(nameof(GetIpAddress))]
|
|
public async Task<IActionResult> GetIpAddress([FromQuery] string hostname)
|
|
{
|
|
return Ok(await _networkService.GetIpAddressAsync(hostname));
|
|
}
|
|
}
|
|
}
|