Files
CartriX/CartriX.Api/Controllers/Printer/PrinterMap.cs
T
Hukuta 24adf91ad9 Обновил модель базы данных
Слегка изменил сущности
Добавил страницу в Web
Сделал компонент с карточками для принетров
2026-05-31 03:10:04 +09:00

35 lines
1.3 KiB
C#

using System.Xml.Linq;
namespace CartriX.Api.Controllers.Cartridge
{
public static class PrinterMap
{
public static Shared.Models.Printer.PrinterItem ToItem(this Entities.Printer printer) => new()
{
Name = printer.Name,
IpAddressOrHostname = printer.IpAddressOrHostname,
CountPrintedAllTime = printer.CountPrintedAllTime,
OidForQueryCountPrintedAllTime = printer.OidForQueryCountPrintedAllTime,
PrintTypeName = printer.PrintType.Name,
Model = printer.Model.ToItem(),
StatusName = printer.Status.Name,
ConnetctionTypeName = printer.ConnetctionType.Name,
InstalledCartridgeId = printer.InstalledCartridge.Id,
LocationName = printer.Location.Name,
};
public static Shared.Models.Printer.PrinterModelItem ToItem(this Entities.PrinterModel model) => new()
{
Name = model.Name,
Manufacturer = model.Manufacturer.ToItem(),
};
public static Shared.Models.Printer.PrinterItemList ToItemList(this Entities.Printer printer) => new()
{
Id = printer.Id,
Name = printer.Name,
Model = printer.Model.ToItem(),
StatusId = printer.StatusId
};
}
}