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.

MenuController.cs 731B

1234567891011121314151617181920212223242526272829
  1. using Microsoft.AspNetCore.Mvc;
  2. using ProRestaurant.Repository.Restaurants;
  3. namespace ProRestaurant.Controllers.Restaurants
  4. {
  5. [Route("api/[controller]")]
  6. [ApiController]
  7. public class MenuController : ControllerBase
  8. {
  9. private readonly IMenuRepository repo;
  10. public MenuController(IMenuRepository _repo)
  11. {
  12. repo = _repo;
  13. }
  14. [HttpGet("{id}")]
  15. public IActionResult Get(int id)
  16. {
  17. return new OkObjectResult(repo.GetMenu(id));
  18. }
  19. [HttpGet("GetOptions/{menuId}")]
  20. public IActionResult GetOptions(int menuId)
  21. {
  22. return new OkObjectResult(repo.GetOptions(menuId));
  23. }
  24. }
  25. }