mirror of
https://gitlab.com/Hukuta47/cartrix.git
synced 2026-12-06 13:00:55 +00:00
33 lines
912 B
C#
33 lines
912 B
C#
using CartriX.Api.Classes;
|
|
using CartriX.Api.Entities;
|
|
using CartriX.Api.Interfaces;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace CartriX.Api.Services
|
|
{
|
|
public class PrinterService : IPrinterService
|
|
{
|
|
private readonly AppDbContext _context;
|
|
public PrinterService(AppDbContext context)
|
|
{
|
|
_context = context;
|
|
}
|
|
public async Task<bool> AddAsync(DTOs.Printer.AddPrinter requestDto)
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
}
|
|
|
|
|
|
public async Task<Entities.Printer?> GetAsync(int id) => await _context.Printers.Include(l => l.location).Include(m => m.model).FirstAsync(p => p.id == id);
|
|
public async Task<List<string>> GetModelsAsync() => await _context.PrinterModels.Select(m => m.name).ToListAsync();
|
|
public async Task<List<Entities.PrintType>> GetPrintTypesAsync() => await _context.PrintTypes.ToListAsync();
|
|
}
|
|
}
|