This commit is contained in:
Mikhail Kuznetsov
2023-06-01 16:42:44 +10:00
parent f0d28c0802
commit e465932222
29 changed files with 206 additions and 34 deletions

View File

@@ -0,0 +1,9 @@
using PARR.API.Controllers.V1.Base;
namespace PARR.API.Controllers.V1
{
public class ApiStatusController : BaseApiController
{
//TODO:
}
}

View File

@@ -0,0 +1,10 @@
using Microsoft.AspNetCore.Mvc;
namespace PARR.API.Controllers.V1.Base
{
[ApiController]
public class BaseApiController : ControllerBase
{
}
}

View File

@@ -0,0 +1,26 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using PARR.DAL.Services.Interfaces;
namespace PARR.API.Controllers.V1
{
public class HomeController : Controller
{
private readonly IHostService hostService;
public HomeController(IHostService hostService)
{
this.hostService = hostService;
}
[HttpGet("test")]
public async Task<IActionResult> Index()
{
var hosts = await hostService.Get().ToListAsync();
//foreach (var host in hosts) { logger.LogInformation($"{host.HostName}"); }
//return View();
return Ok(hosts.Select(t => new { t.HostName, t.IP, t.Id }));
}
}
}