51 lines
1.1 KiB
C#
51 lines
1.1 KiB
C#
|
using Microsoft.AspNetCore.Http;
|
|||
|
using Microsoft.AspNetCore.Mvc;
|
|||
|
using BankContracts.BindingModels;
|
|||
|
using BankContracts.BusinessLogicsContracts;
|
|||
|
using BankContracts.SearchModels;
|
|||
|
using BankContracts.ViewModels;
|
|||
|
using BankDatabaseImplement.Models;
|
|||
|
|
|||
|
namespace BankRestApi.Controllers
|
|||
|
{
|
|||
|
[Route("api/[controller]/[action]")]
|
|||
|
[ApiController]
|
|||
|
public class CurrencyController : Controller
|
|||
|
{
|
|||
|
private readonly ILogger _logger;
|
|||
|
private readonly ICurrencyLogic _currency;
|
|||
|
public CurrencyController(ILogger<CurrencyController> logger, ICurrencyLogic currency)
|
|||
|
{
|
|||
|
_logger = logger;
|
|||
|
_currency = currency;
|
|||
|
}
|
|||
|
|
|||
|
[HttpPost]
|
|||
|
public bool CreateCurrency(CurrencyBindingModel model)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
return _currency.Create(model);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
_logger.LogError(ex, "Не удалось создать медикамент");
|
|||
|
throw;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
[HttpPost]
|
|||
|
public bool DeleteCurrency(CurrencyBindingModel model)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
return _currency.Delete(model);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
_logger.LogError(ex, "Ошибка удаления магазина");
|
|||
|
throw;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|