Правки

This commit is contained in:
Glliza 2024-11-29 00:10:18 +04:00
parent 4546884a33
commit 4863480b53

View File

@ -1,5 +1,6 @@
using ShoeStore.Entities;
using ShoeStore.Repositories;
using ShoeStore.Repositories.Implementations;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@ -40,15 +41,23 @@ public partial class FormEmployee : Form
}
}
public FormEmployee()
public FormEmployee(IEmployeeRepository employeeRepository)
{
InitializeComponent();
_employeeRepository = employeeRepository ?? throw new ArgumentNullException(nameof(employeeRepository));
}
private void ButtonSave_Click_1(object sender, EventArgs e)
{
try
{
if (numericUpDownNumStorage.Value <= 0 || numericUpDownStorageSize.Value <= 0)
{
throw new Exception("Имеются незаполненные поля");
return;
}
if (_employeeId.HasValue)
{
_employeeRepository.UpdateEmployee(CreateEmployee(_employeeId.Value));