CourseWork_Borschevskaya_A..../Hospital/HospitalRestApi/Controllers/ProcedureController.cs

39 lines
1.0 KiB
C#

using HospitalContracts.BusinessLogicContracts;
using HospitalContracts.SearchModels;
using HospitalContracts.ViewModels;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace HospitalRestApi.Controllers
{
[Route("api/[controller]/[action]")]
[ApiController]
public class ProcedureController : ControllerBase
{
private readonly ILogger _logger;
private readonly IProcedureLogic _logic;
public ProcedureController(ILogger<ProcedureController> logger, IProcedureLogic logic)
{
_logger = logger;
_logic = logic;
}
[HttpGet]
public List<ProcedureViewModel>? GetProcedures()
{
try
{
return _logic.ReadList(null);
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка получения списка процедур");
throw;
}
}
}
}