ISEbd-21_Melnikov_I.O._CarS.../CarService/CarServiceView/FormAddWorkTest.cs

34 lines
678 B
C#
Raw Normal View History

using CarServiceContracts.BusinessLogicsContracts;
namespace CarServiceView
{
public partial class FormAddWorkTest : Form
{
IWorkLogic _workLogic;
public FormAddWorkTest(IWorkLogic workLogic)
{
_workLogic = workLogic;
InitializeComponent();
}
private void buttonAdd_Click(object sender, EventArgs e)
{
try
{
_workLogic.Create(new()
{
Name = textBoxName.Text,
Price = Convert.ToDecimal(textBoxCost.Text),
Duration = Convert.ToDecimal(textBoxDuration.Text),
WorkerId = 1
});
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}