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.

CategoriesController.cs 776B

12345678910111213141516171819202122232425
  1. using Microsoft.AspNetCore.Mvc;
  2. namespace Diligent.WebAPI.Host.Controllers.V1
  3. {
  4. [ApiVersion("1.0")]
  5. [Route("v{version:apiVersion}/categories")]
  6. [ApiController]
  7. public class CategoriesController : ControllerBase
  8. {
  9. private readonly ICategoryService _categoryService;
  10. public CategoriesController(ICategoryService categoryService)
  11. {
  12. _categoryService = categoryService;
  13. }
  14. [HttpGet("names")]
  15. public async Task<IActionResult> GetCategoriesNames() =>
  16. Ok(await _categoryService.GetCategoriesNamesAsync());
  17. [HttpGet("granted-categories")]
  18. public async Task<IActionResult> GetCategories(int userId) =>
  19. Ok(await _categoryService.GetCategories(userId));
  20. }
  21. }