Skip to content

Instantly share code, notes, and snippets.

@ibrahimozgon
Last active April 3, 2019 11:26
Show Gist options
  • Save ibrahimozgon/2854b753ac55902d4bb2353baec6083f to your computer and use it in GitHub Desktop.
Save ibrahimozgon/2854b753ac55902d4bb2353baec6083f to your computer and use it in GitHub Desktop.
[Route("api/[controller]")]
[ApiController]
public class ProductsController : ControllerBase
{
private readonly MyDbContext _context;
public ProductsController(MyDbContext context)
{
_context = context;
}
// GET api/values
[HttpGet]
//1
[EnableQuery]
public ActionResult<IQueryable<Product>> Get()
{
return _context.Products;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment