84 lines
2.0 KiB
C#
84 lines
2.0 KiB
C#
using System;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.Extensions.Logging;
|
|
using xAiApi.Helpers;
|
|
using xCommons.Configurations;
|
|
using xCommons.Controllers;
|
|
using xCommons.Extensions;
|
|
using xCommons.Providers;
|
|
using xIdentityHelper;
|
|
|
|
namespace xAiApi.Controllers
|
|
{
|
|
public class OSController : XBaseController
|
|
{
|
|
public OSController(
|
|
ILogger<OSController> logger,
|
|
XAppConfiguration appConfiguration,
|
|
XValidationProvider validationProvider
|
|
) : base(
|
|
logger,
|
|
appConfiguration,
|
|
validationProvider
|
|
)
|
|
{ }
|
|
|
|
//
|
|
#region Actions ...
|
|
/// <summary>
|
|
/// Get OS Type ...
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpGet("OSType")]
|
|
[Authorize(Policy = XPolicies.Admin)]
|
|
public ActionResult<string> GetOSType()
|
|
{
|
|
//
|
|
// Do ...
|
|
try
|
|
{
|
|
//
|
|
var osType = XOsHelper.GetOSType();
|
|
var result = osType.GetStringValue();
|
|
|
|
//
|
|
return Ok(result);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
//
|
|
var result = GetExceptionActionResult(ex);
|
|
return result;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get OS Description ...
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpGet("OSDescription")]
|
|
[Authorize(Policy = XPolicies.Admin)]
|
|
public ActionResult<string> GetOSDescription()
|
|
{
|
|
//
|
|
// Do ...
|
|
try
|
|
{
|
|
//
|
|
var result = XOsHelper.GetOSDescription();
|
|
|
|
//
|
|
return Ok(result);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
//
|
|
var result = GetExceptionActionResult(ex);
|
|
return result;
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
} |