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

35 lines
839 B
C#

using CarServiceContracts.BusinessLogicsContracts;
using Microsoft.Extensions.Logging;
namespace CarServiceView
{
public partial class FormRegistrationWorker : Form
{
private readonly ILogger _logger;
private readonly IWorkerLogic _workerLogic;
public FormRegistrationWorker(ILogger<FormRegistrationWorker> logger, IWorkerLogic workerLogic)
{
_logger = logger;
_workerLogic = workerLogic;
InitializeComponent();
}
private void buttonRegister_Click(object sender, EventArgs e)
{
try
{
_workerLogic.Create(new()
{
Login = textBoxLogin.Text,
Password = textBoxPassword.Text,
Name = textBoxName.Text,
Surname = textBoxSurname.Text
});
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}