Files
CartriX/CartriX.Api/Controllers/PrinterController.cs
T

27 lines
646 B
C#

using Microsoft.AspNetCore.Mvc;
using CartriX.Shared.Models;
namespace CartriX.Api.Controllers
{
[ApiController]
[Route("api/Printer")]
public class PrinterController : ControllerBase
{
private readonly AppDbContext _context;
public PrinterController(AppDbContext context)
{
_context = context;
}
[HttpGet("{id}")]
public ActionResult GetPrinter(int id)
{
Printer printer = _context.Printers.Find(id)!;
if (printer == null)
{
return NotFound();
}
return Ok(printer);
}
}
}