Apps and Services with .NET 7 by Mark J. Price

Apps and Services with .NET 7 by Mark J. Price

Author:Mark J. Price [Mark J. Price]
Language: eng
Format: epub
Publisher: Packt Publishing
Published: 2022-11-15T00:00:00+00:00


using Microsoft.AspNetCore.Mvc; // IActionResult using Microsoft.AspNetCore.OData.Query; // [EnableQuery] using Microsoft.AspNetCore.OData.Routing.Controllers; // ODataController using Packt.Shared; // NorthwindContext namespace Northwind.OData.Service.Controllers; public class CategoriesController : ODataController { protected readonly NorthwindContext db; public CategoriesController(NorthwindContext db) { this.db = db; } [EnableQuery] public IActionResult Get() { return Ok(db.Categories); } [EnableQuery] public IActionResult Get(int key) { return Ok(db.Categories.Where( category => category.CategoryId == key)); } }



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.