refactor: Projektdateien migriert. Cloud-NuGet-Pakete durch lokale NuGet-Projekte ersetzt.
This commit is contained in:
55
HRD.WebApi/Controllers/InfoBaseController.cs
Normal file
55
HRD.WebApi/Controllers/InfoBaseController.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using HRD.WebApi.DAL;
|
||||
using HRD.WebApi.Helpers;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
|
||||
namespace HRD.WebApi.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[Produces("application/json")]
|
||||
[ApiController]
|
||||
public abstract class InfoBaseController : BaseMiniController
|
||||
{
|
||||
public InfoBaseController(WebApiBaseContext webApiBaseContext) : base(webApiBaseContext)
|
||||
{
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public ActionResult<ServerInfo> GetInfos()
|
||||
{
|
||||
try
|
||||
{
|
||||
var serverInfo = GetServerInfo();
|
||||
return StatusCode(serverInfo.Status, serverInfo);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
WriteLogException(ex);
|
||||
return NotFound();
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult<ServerInfo> GetInfos([FromBody] ServerInfo serverInfoFromClient)
|
||||
{
|
||||
try
|
||||
{
|
||||
var serverInfo = GetServerInfo();
|
||||
serverInfo.LastOfflineTime = serverInfoFromClient.LastOfflineTime;
|
||||
|
||||
return new OkObjectResult(serverInfo);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
WriteLogException(ex);
|
||||
return NotFound();
|
||||
}
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
public virtual ServerInfo GetServerInfo()
|
||||
{
|
||||
return ServerInfoHelper.GetServerInfo(base.Context);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user