Files
CartriX/CartriX.Api/Controllers/Printer/PrinterMap.cs
T

43 lines
1.7 KiB
C#

namespace CartriX.Api.Controllers.Printer
{
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.PrinterConnetctionType.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,
ModelName = printer.Model.Name,
StatusId = printer.StatusId
};
public static Shared.Models.Printer.PrinterConnectionTypeItem ToItem(this Entities.PrinterConnetctionType type) => new()
{
Id = type.Id,
Name = type.Name
};
public static Shared.Models.Printer.PrinterPrintTypeItem ToItem(this Entities.PrinterPrintType type) => new()
{
Id = type.Id,
Name = type.Name
};
}
}