mirror of
https://gitlab.com/Hukuta47/cartrix.git
synced 2026-12-05 12:30:55 +00:00
Сделал сервис который опрашивает принтеры
This commit is contained in:
1 parent
5f0c14a7a7
commit
dad8b27322
16 files changed
+232
-706
No files matched your search
@@ -28,7 +28,7 @@ namespace CartriX.Api.Controllers.Network
|
||||
}
|
||||
else
|
||||
{
|
||||
var ipAddress = await NetworkHelper.GetIPFromHostname(IpAddressOrHostname);
|
||||
var ipAddress = await NetworkHelper.GetIPFromHostnameAsync(IpAddressOrHostname);
|
||||
return Ok(await SnmpHelper.GetSnmpData(ipAddress.ToString(), OID));
|
||||
}
|
||||
}
|
||||
@@ -38,6 +38,6 @@ namespace CartriX.Api.Controllers.Network
|
||||
[ProducesResponseType(typeof(bool), StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(typeof(bool), StatusCodes.Status404NotFound)]
|
||||
[HttpGet(nameof(Ping))]
|
||||
public async Task<ActionResult> Ping([FromQuery] string IpAddressOrHostname) => (await NetworkHelper.PingHost(IpAddressOrHostname)) ? StatusCode(200, true) : StatusCode(404, false);
|
||||
public async Task<ActionResult> Ping([FromQuery] string IpAddressOrHostname) => (await NetworkHelper.PingHostAsync(IpAddressOrHostname)) ? StatusCode(200, true) : StatusCode(404, false);
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ namespace CartriX.Api.Controllers.Cartridge
|
||||
PrintTypeName = printer.PrintType.Name,
|
||||
Model = printer.Model.ToItem(),
|
||||
StatusName = printer.Status.Name,
|
||||
ConnetctionTypeName = printer.ConnetctionType.Name,
|
||||
ConnetctionTypeName = printer.PrinterConnetctionType.Name,
|
||||
InstalledCartridgeId = printer.InstalledCartridge.Id,
|
||||
LocationName = printer.Location.Name,
|
||||
};
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace CartriX.Api.Controllers.Cartridge
|
||||
.Include(p => p.Model)
|
||||
.ThenInclude(m => m.SupportedArticle)
|
||||
.Include(p => p.Status)
|
||||
.Include(p => p.ConnetctionType)
|
||||
.Include(p => p.PrinterConnetctionType)
|
||||
.Include(p => p.InstalledCartridge)
|
||||
.Include(p => p.Location)
|
||||
.FirstOrDefaultAsync(c => c.Id == Id);
|
||||
|
||||
Reference in new issue
Block a user