45 lines
1.4 KiB
C#
45 lines
1.4 KiB
C#
using ProjectLibrary.Entites;
|
||
|
||
namespace ProjectLibrary.Forms
|
||
{
|
||
public partial class FBook_library : Form
|
||
{
|
||
private Book_Library _bookLibrary;
|
||
|
||
public FBook_library(Book_Library bookLibrary)
|
||
{
|
||
InitializeComponent();
|
||
_bookLibrary = bookLibrary;
|
||
LoadLibraryData();
|
||
}
|
||
|
||
private void LoadLibraryData()
|
||
{
|
||
txtBookID.Text = _bookLibrary.BookID.ToString();
|
||
txtLibraryID.Text = _bookLibrary.LibraryID.ToString();
|
||
txtCount.Text = _bookLibrary.Count.ToString();
|
||
}
|
||
|
||
private void btnSave_Click(object sender, EventArgs e)
|
||
{
|
||
// Создание новой сущности с измененными данными
|
||
var updatedBookLibrary = Book_Library.CreateEntity(
|
||
int.Parse(txtBookID.Text),
|
||
int.Parse(txtLibraryID.Text),
|
||
int.Parse(txtCount.Text)
|
||
);
|
||
|
||
// Обновление внутренней переменной
|
||
_bookLibrary = updatedBookLibrary;
|
||
|
||
MessageBox.Show("Данные успешно сохранены!");
|
||
}
|
||
|
||
private void buttonCancel_Click_Click(object sender, EventArgs e)
|
||
{
|
||
// Закрытие формы без сохранения
|
||
this.Close();
|
||
}
|
||
}
|
||
}
|