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); } } } }