This commit is contained in:
Николай 2023-03-12 12:36:13 +04:00
parent 0d74990bbb
commit 6de7e02f99
2 changed files with 8 additions and 8 deletions

View File

@ -8,7 +8,7 @@ namespace FoodOrdersView
public partial class FormShop : Form public partial class FormShop : Form
{ {
private readonly ILogger _logger; private readonly ILogger _logger;
private readonly IShopLogic _logic; private readonly IShopLogic _logicS;
private int? _id; private int? _id;
private Dictionary<int, (IDishModel, int)> _shopDishes; private Dictionary<int, (IDishModel, int)> _shopDishes;
public int Id { set { _id = value; } } public int Id { set { _id = value; } }
@ -16,7 +16,7 @@ namespace FoodOrdersView
{ {
InitializeComponent(); InitializeComponent();
_logger = logger; _logger = logger;
_logic = logic; _logicS = logic;
_shopDishes = new Dictionary<int, (IDishModel, int)>(); _shopDishes = new Dictionary<int, (IDishModel, int)>();
} }
private void FormShop_Load(object sender, EventArgs e) private void FormShop_Load(object sender, EventArgs e)
@ -26,7 +26,7 @@ namespace FoodOrdersView
_logger.LogInformation("Загрузка магазина"); _logger.LogInformation("Загрузка магазина");
try try
{ {
var view = _logic.ReadElement(new ShopSearchModel var view = _logicS.ReadElement(new ShopSearchModel
{ {
Id = _id.Value Id = _id.Value
}); });
@ -92,7 +92,7 @@ namespace FoodOrdersView
DateOfOpening = dateTimePicker.Value.Date, DateOfOpening = dateTimePicker.Value.Date,
ShopDishes = _shopDishes ShopDishes = _shopDishes
}; };
var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model); var operationResult = _id.HasValue ? _logicS.Update(model) : _logicS.Create(model);
if (!operationResult) if (!operationResult)
{ {
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах."); throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");

View File

@ -6,12 +6,12 @@ namespace FoodOrdersView
public partial class FormShops : Form public partial class FormShops : Form
{ {
private readonly ILogger _logger; private readonly ILogger _logger;
private readonly IShopLogic _logic; private readonly IShopLogic _logicS;
public FormShops(ILogger<FormShops> logger, IShopLogic logic) public FormShops(ILogger<FormShops> logger, IShopLogic logic)
{ {
InitializeComponent(); InitializeComponent();
_logger = logger; _logger = logger;
_logic = logic; _logicS = logic;
} }
private void FormShops_Load(object sender, EventArgs e) private void FormShops_Load(object sender, EventArgs e)
{ {
@ -21,7 +21,7 @@ namespace FoodOrdersView
{ {
try try
{ {
var list = _logic.ReadList(null); var list = _logicS.ReadList(null);
if (list != null) if (list != null)
{ {
dataGridView.DataSource = list; dataGridView.DataSource = list;
@ -52,7 +52,7 @@ namespace FoodOrdersView
_logger.LogInformation("Удаление магазина"); _logger.LogInformation("Удаление магазина");
try try
{ {
if (!_logic.Delete(new ShopBindingModel if (!_logicS.Delete(new ShopBindingModel
{ {
Id = id Id = id
})) }))