You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
551 B
24 lines
551 B
using BlazingPizza.Data;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace BlazingPizza.Controllers
|
|
{
|
|
[Route("specials")]
|
|
[ApiController]
|
|
public class SpecialsController : Controller
|
|
{
|
|
private readonly PizzaStoreContext _db;
|
|
|
|
public SpecialsController(PizzaStoreContext db)
|
|
{
|
|
_db = db;
|
|
}
|
|
|
|
[HttpGet]
|
|
public async Task<ActionResult<List<PizzaSpecial>>> GetSpecials()
|
|
{
|
|
return (await _db.Specials.ToListAsync()).OrderByDescending(s => s.BasePrice).ToList();
|
|
}
|
|
}
|
|
}
|
|
|