Created
April 15, 2019 00:10
-
-
Save adlerpagliarini/1e780f383db911a663ccaf5a5a68eb99 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
public class DeveloperController : ControllerBase | |
{ | |
... | |
[HttpGet] | |
[Route("{id}")] | |
// 4. Enable OData | |
[EnableQuery()] | |
public async Task<ActionResult<Developer>> Get(int id) | |
{ | |
var developer = await _context.Developer.FindAsync(id); | |
if (developer == null) return NotFound(); | |
return developer; | |
} | |
[HttpGet] | |
// 4. Enable OData | |
[EnableQuery()] | |
public IEnumerable<Developer> Get() => _context.Developer.AsQueryable(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment