32 lines
758 B
C#
32 lines
758 B
C#
using Bibblan.Business.Services;
|
|
using Bibblan.Models;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace Bibblan.Controllers
|
|
{
|
|
[ApiController]
|
|
[Route("api/[controller]")]
|
|
public class CalibreController : ControllerBase
|
|
{
|
|
CalibreService _service;
|
|
public CalibreController(CalibreService service) {
|
|
_service = service;
|
|
}
|
|
|
|
[HttpGet("books")]
|
|
public IActionResult GetBooks()
|
|
{
|
|
var books = _service.GetAllBooks().Take(100).ToList();
|
|
return Ok(books);
|
|
}
|
|
|
|
[HttpGet("cover")]
|
|
public IActionResult GetCover(string path)
|
|
{
|
|
var bytes = _service.Cover(path);
|
|
return File(bytes, "image/jpeg", true);
|
|
}
|
|
|
|
}
|
|
}
|