mirror of
https://gitlab.com/Hukuta47/cartrix.git
synced 2026-12-05 12:30:55 +00:00
Обновил модель базы данных
Слегка изменил сущности Добавил страницу в Web Сделал компонент с карточками для принетров
This commit is contained in:
1 parent
9cc166e37d
commit
24adf91ad9
16 files changed
+788
-21
No files matched your search
@@ -6,7 +6,7 @@ namespace CartriX.Api.Controllers.Location
|
||||
public static Shared.Models.Location.LocationItem ToItem(this Entities.Location location) => new()
|
||||
{
|
||||
Name = location.Name,
|
||||
Printers = location.Printers.Select(p => p.ToItem()).ToList()
|
||||
Printers = location.Printers.Select(p => p.ToItemList()).ToList()
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,6 @@ namespace CartriX.Api.Controllers.Location
|
||||
{
|
||||
public class LocationService(AppDbContext _context) : ILocationService
|
||||
{
|
||||
public async Task<List<Entities.Location>> List() => await _context.Locations.ToListAsync();
|
||||
public async Task<List<Entities.Location>> List() => await _context.Locations.Include(l => l.Printers).ThenInclude(p => p.Model).ThenInclude(m => m.Manufacturer).ToListAsync();
|
||||
}
|
||||
}
|
||||
@@ -41,5 +41,6 @@ namespace CartriX.Api.Controllers.Printer
|
||||
var cartridge = await _printerService.GetPrinterAsync(Id);
|
||||
return (cartridge is not null) ? StatusCode(200, cartridge.ToItem()) : StatusCode(404, $"Принтер с идентификатором \"{Id}\" не найден.");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -24,12 +24,10 @@ namespace CartriX.Api.Controllers.Cartridge
|
||||
};
|
||||
public static Shared.Models.Printer.PrinterItemList ToItemList(this Entities.Printer printer) => new()
|
||||
{
|
||||
Id = printer.Id,
|
||||
Name = printer.Name,
|
||||
Model = printer.Model.ToItem(),
|
||||
StatusId = printer.Status.Name,
|
||||
ConnetctionTypeName = printer.ConnetctionType.Name,
|
||||
InstalledCartridgeId = printer.InstalledCartridge.Id,
|
||||
LocationName = printer.Location.Name,
|
||||
StatusId = printer.StatusId
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -4,13 +4,8 @@ using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace CartriX.Api.Controllers.Cartridge
|
||||
{
|
||||
public class PrinterService : IPrinterService
|
||||
public class PrinterService(AppDbContext _context) : IPrinterService
|
||||
{
|
||||
private readonly AppDbContext _context;
|
||||
public PrinterService(AppDbContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
/// <summary>
|
||||
/// Добавление принетера в базу данных
|
||||
/// </summary>
|
||||
@@ -30,7 +25,7 @@ namespace CartriX.Api.Controllers.Cartridge
|
||||
OidForQueryCountPrintedAllTime = printer.OidForQueryCountPrintedAllTime,
|
||||
PrintTypeId = printer.PrintTypeId,
|
||||
Model = Model,
|
||||
PrinterStatusId = 1,
|
||||
StatusId = 1,
|
||||
PrinterConnetctionTypeId = printer.PrinterConnetctionTypeId,
|
||||
InstalledCartridge = new() { Model = new() { Name = Article.Name, Manufacturer = Manufacturer, SupportedArticles = new() { Article } }, Volume = printer.VolumeBuiltInCartridge },
|
||||
Location = Location
|
||||
|
||||
Reference in new issue
Block a user