2024-11-19 19:46:02 +04:00
|
|
|
|
using ProjectLibrary.Forms;
|
|
|
|
|
using System;
|
2024-11-12 23:13:20 +04:00
|
|
|
|
using System.Collections.Generic;
|
2024-12-20 11:46:58 +04:00
|
|
|
|
using System.ComponentModel;
|
2024-11-12 23:13:20 +04:00
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace ProjectLibrary.Entites
|
|
|
|
|
{
|
|
|
|
|
public class Library
|
|
|
|
|
{
|
|
|
|
|
public int Id { get; private set; }
|
2024-12-20 11:46:58 +04:00
|
|
|
|
|
|
|
|
|
[DisplayName("Название")]
|
2024-11-12 23:13:20 +04:00
|
|
|
|
public string Name { get; private set; } = string.Empty;
|
2024-12-20 15:49:09 +04:00
|
|
|
|
|
2024-12-20 11:46:58 +04:00
|
|
|
|
[DisplayName("Адрес")]
|
2024-11-12 23:13:20 +04:00
|
|
|
|
public string Address { get; private set; } = string.Empty;
|
2024-12-20 15:49:09 +04:00
|
|
|
|
|
|
|
|
|
[Browsable(false)]
|
2024-11-19 19:46:02 +04:00
|
|
|
|
public IEnumerable<Book_Library> BookLibrary
|
|
|
|
|
{
|
|
|
|
|
get;
|
|
|
|
|
private set;
|
2024-12-08 13:24:07 +04:00
|
|
|
|
}
|
2024-11-12 23:13:20 +04:00
|
|
|
|
|
2024-12-20 15:49:09 +04:00
|
|
|
|
[DisplayName("Перечень книг в библиотеке")]
|
|
|
|
|
public string ListBookInLibrary => BookLibrary != null ?
|
|
|
|
|
string.Join("; ", BookLibrary.Select(x => $"{x.BookID},{x.Count}")): string.Empty;
|
|
|
|
|
|
2024-11-19 19:46:02 +04:00
|
|
|
|
public static Library CreateEntity(int id, string name, string address, IEnumerable<Book_Library> bookLibrary)
|
2024-11-12 23:13:20 +04:00
|
|
|
|
{
|
|
|
|
|
return new Library
|
|
|
|
|
{
|
|
|
|
|
Id = id,
|
|
|
|
|
Name = name ?? string.Empty,
|
2024-11-19 19:46:02 +04:00
|
|
|
|
Address = address ?? string.Empty,
|
|
|
|
|
BookLibrary = bookLibrary
|
2024-11-12 23:13:20 +04:00
|
|
|
|
};
|
|
|
|
|
}
|
2024-12-20 15:49:09 +04:00
|
|
|
|
|
|
|
|
|
public void SetLibraryForBook(IEnumerable<Book_Library> book_Library)
|
|
|
|
|
{
|
|
|
|
|
if (book_Library != null && book_Library.Any())
|
|
|
|
|
{
|
|
|
|
|
BookLibrary = book_Library;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-11-12 23:13:20 +04:00
|
|
|
|
}
|
|
|
|
|
}
|