Created
March 8, 2018 07:54
-
-
Save gashupl/a052688bea027a976d7f0f0f55a82bbd to your computer and use it in GitHub Desktop.
This file contains hidden or 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 ItemsController : ODataController | |
| { | |
| private readonly IItemsRepository itemsRepository;</code> | |
| public ItemsController(IItemsRepository itemsRepository) | |
| { | |
| this.itemsRepository = itemsRepository; | |
| } | |
| [EnableQuery] | |
| public IList Get() | |
| { | |
| return this.itemsRepository.GetItems().ToList(); | |
| } | |
| [EnableQuery] | |
| public SingleResult Get([FromODataUri] Guid key) | |
| { | |
| IQueryable result = itemsRepository.GetItems().Where(p => p.Id == key).AsQueryable(); | |
| return SingleResult.Create(result); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment