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.
28 lines
539 B
28 lines
539 B
11 months ago
|
using Microsoft.AspNetCore.Mvc;
|
||
|
using WebApi.Models;
|
||
|
using WebApi.Services;
|
||
|
|
||
|
namespace WebApi.Controllers;
|
||
|
|
||
|
[ApiController]
|
||
|
[Route("[controller]")]
|
||
|
public class PizzaController : Controller
|
||
|
{
|
||
|
public PizzaController()
|
||
|
{
|
||
|
|
||
|
}
|
||
|
|
||
|
[HttpGet]
|
||
|
public ActionResult<List<Pizza>> GetAll() => PizzaService.GetAll();
|
||
|
|
||
|
[HttpGet("{id}")]
|
||
|
public ActionResult<Pizza> Get(int id)
|
||
|
{
|
||
|
var pizza = PizzaService.Get(id);
|
||
|
if (pizza == null)
|
||
|
return NotFound();
|
||
|
|
||
|
return pizza;
|
||
|
}
|
||
|
}
|