38 lines
1.0 KiB
C#
38 lines
1.0 KiB
C#
|
using CanteenContracts.BusinessLogicsContracts;
|
||
|
using CanteenContracts.View;
|
||
|
using Microsoft.AspNetCore.Mvc;
|
||
|
|
||
|
namespace CanteenRestApi.Controllers
|
||
|
{
|
||
|
[Route("api/[controller]/[action]")]
|
||
|
[ApiController]
|
||
|
public class MainController : ControllerBase
|
||
|
{
|
||
|
private readonly ILogger _logger;
|
||
|
private readonly ICookLogic _cook;
|
||
|
private readonly IDishLogic _dish;
|
||
|
private readonly IProductLogic _product;
|
||
|
|
||
|
public MainController(ILogger<MainController> logger, ICookLogic cook, IDishLogic dish, IProductLogic product)
|
||
|
{
|
||
|
_logger = logger;
|
||
|
_cook = cook;
|
||
|
_dish = dish;
|
||
|
_product = product;
|
||
|
}
|
||
|
|
||
|
[HttpGet]
|
||
|
public List<CookViewModel>? GetCookList()
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
return _cook.ReadList(null);
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
_logger.LogError(ex, "Error during loading list of bouquets");
|
||
|
throw;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|