using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.OData.Query;
using Microsoft.AspNetCore.OData.Results;
using Microsoft.AspNetCore.OData.Routing.Controllers;
public class PixivImagesController : ODataController
{
private readonly AppDbContext _db;
public PixivImagesController(AppDbContext db) => _db = db;
// GET /odata/PixivImages
[EnableQuery]
public IQueryable<PixivImage> Get()
=> _db.PixivImages;
// GET /odata/PixivImages('{id}')
[EnableQuery]
public SingleResult<PixivImage> Get([FromRoute] Guid key)
=> SingleResult.Create(_db.PixivImages.Where(x => x.Id == key));
}