Hello again i coded this example to learn entity-framework. Build a CRUD Application with ASP.NET Core 3.0 & Entity Framework 3.0 Using Visual Studio 2019
now on the index.cshtml i added two radiobuttons:
<input type="radio" name="rdbAll" value="All" id="all-1" checked>
<label for="all-1">Show all</label>
<input type="radio" name="rdbOutOfStock" value="out" id="out-1">
<label for="out-1">Show out of stock</label>
if i check All i will show all entries. if i check out of stock i will only show the products where quantity == 0
i know i can do something like that:
// GET: api/Products
[HttpGet]
public async Task<ActionResult<IEnumerable>> GetProducts()
{
var products = _context.Products.AsQueryable();
products = _context.Products.Where(i => i.AvailableQuantity == 0);
return await products.ToListAsync();
}
how can i call this function by checking the radio button.
Thank you!