Добавил выпадающие списки в диалоговом окне добавления принтера

This commit is contained in:
Hukuta committed 2026-05-08 11:45:26 +09:00
1 parent 88f53c793e
commit b492435289
8 files changed
+106 -5

No files matched your search

@@ -53,6 +53,16 @@ namespace CartriX.Api.Controllers
return Ok($"Принтер с названием хоста \"{requestDto.hostname}\" был добавлен.");
}
[HttpGet("Models")]
public async Task<IActionResult> GetAllModels()
{
var list = await _printerService.GetAllPrinterModel();
var convert = list.Select(m => m.ToDto());
return Ok(convert);
}
[HttpGet("GetSNMP/{ipAddressOrHostname}")]
public async Task<IActionResult> GetPrinterListParametersFromSNMPAsync([FromRoute] string ipAddressOrHostname)
{
@@ -9,5 +9,6 @@ namespace CartriX.Api.Interfaces
public Task<Printer?> GetById(int id);
public Task<Printer> AddAsync(CreatePrinterRequestDto requestDto);
public Task<QueryPrinterToAdd?> GetPrinterListParametersFromSNMPAsync(string ipAddressOrHostname);
public Task<List<PrinterModel>> GetAllPrinterModel();
}
}
+2 -1
View File
@@ -36,7 +36,6 @@ namespace CartriX.Api.Services
.Include(m => m.model).ToListAsync();
return queryResult;
}
public async Task<Printer?> GetById(int id)
{
Console.WriteLine("Запрос в базу данных.");
@@ -44,6 +43,8 @@ namespace CartriX.Api.Services
return queryResult;
}
public async Task<List<PrinterModel>> GetAllPrinterModel() => await _context.PrinterModels.ToListAsync();