GetCurrentCategory.cs 535 B

123456789101112131415161718
  1. using ApiMobileBelov.BaseConnection;
  2. using Microsoft.AspNetCore.Mvc;
  3. namespace ApiMobileBelov.Controllers
  4. {
  5. [Route("api/[controller]/{id}")]
  6. [ApiController]
  7. [ApiExplorerSettings(GroupName = "Категории тренировок")]
  8. public class GetCurrentCategory : ControllerBase
  9. {
  10. ApplicationContext db = new ApplicationContext();
  11. [HttpGet]
  12. public IActionResult Index(int id)
  13. {
  14. return Ok(db.tableCategory.FirstOrDefault(x=>x.IdCategory == id));
  15. }
  16. }
  17. }