CourseWork_Borschevskaya_A..../Hospital/HospitalRestApi/Controllers/TreatmentController.cs

35 lines
813 B
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 TreatmentController : ControllerBase
{
private readonly ITreatmentLogic _logic;
public TreatmentController(ITreatmentLogic logic)
{
_logic = logic;
}
[HttpGet]
public List<TreatmentViewModel>? GetTreatments()
{
try
{
return _logic.ReadList(null);
}
catch (Exception ex)
{
throw;
}
}
}
}