feat(lab-3): do lab-3
This commit is contained in:
13
LibraryDataModels/AbstractModels/IAuthor.cs
Normal file
13
LibraryDataModels/AbstractModels/IAuthor.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LibraryDataModels.AbstractModels
|
||||
{
|
||||
public interface IAuthor : IId
|
||||
{
|
||||
string Name { get; }
|
||||
}
|
||||
}
|
||||
16
LibraryDataModels/AbstractModels/IBook.cs
Normal file
16
LibraryDataModels/AbstractModels/IBook.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LibraryDataModels.AbstractModels
|
||||
{
|
||||
public interface IBook : IId
|
||||
{
|
||||
string Name { get; }
|
||||
string BookCover { get; }
|
||||
string Author { get; }
|
||||
string ReleaseDate { get; }
|
||||
}
|
||||
}
|
||||
13
LibraryDataModels/AbstractModels/IId.cs
Normal file
13
LibraryDataModels/AbstractModels/IId.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LibraryDataModels.AbstractModels
|
||||
{
|
||||
public interface IId
|
||||
{
|
||||
int Id { get; }
|
||||
}
|
||||
}
|
||||
21
LibraryDataModels/Dtos/AuthorDto.cs
Normal file
21
LibraryDataModels/Dtos/AuthorDto.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using LibraryDataModels.AbstractModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LibraryDataModels.Dtos
|
||||
{
|
||||
public class AuthorDto : IAuthor
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public AuthorDto() {}
|
||||
public AuthorDto(IAuthor author)
|
||||
{
|
||||
Id = author.Id;
|
||||
Name = author.Name;
|
||||
}
|
||||
}
|
||||
}
|
||||
27
LibraryDataModels/Dtos/BookDto.cs
Normal file
27
LibraryDataModels/Dtos/BookDto.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using LibraryDataModels.AbstractModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LibraryDataModels.Dtos
|
||||
{
|
||||
public class BookDto : IBook
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public string BookCover { get; set; } = string.Empty;
|
||||
public string Author { get; set; } = string.Empty;
|
||||
public string ReleaseDate { get; set; } = string.Empty;
|
||||
public BookDto() {}
|
||||
public BookDto(IBook book)
|
||||
{
|
||||
Id = book.Id;
|
||||
Name = book.Name;
|
||||
BookCover = book.BookCover;
|
||||
Author = book.Author;
|
||||
ReleaseDate = book.ReleaseDate;
|
||||
}
|
||||
}
|
||||
}
|
||||
9
LibraryDataModels/LibraryDataModels.csproj
Normal file
9
LibraryDataModels/LibraryDataModels.csproj
Normal file
@@ -0,0 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
24
LibraryDataModels/Views/AuthorView.cs
Normal file
24
LibraryDataModels/Views/AuthorView.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using LibraryDataModels.AbstractModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LibraryDataModels.Views
|
||||
{
|
||||
public class AuthorView : IAuthor
|
||||
{
|
||||
public int Id { get; set; } = -1;
|
||||
|
||||
[DisplayName("ФИО автора")]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public AuthorView() {}
|
||||
public AuthorView(IAuthor author)
|
||||
{
|
||||
Id = author.Id;
|
||||
Name = author.Name;
|
||||
}
|
||||
}
|
||||
}
|
||||
34
LibraryDataModels/Views/BookView.cs
Normal file
34
LibraryDataModels/Views/BookView.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using LibraryDataModels.AbstractModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LibraryDataModels.Views
|
||||
{
|
||||
public class BookView : IBook
|
||||
{
|
||||
public int Id { get; set; } = -1;
|
||||
|
||||
[DisplayName("Название")]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public string BookCover { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("ФИО автора")]
|
||||
public string Author { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Дата издания")]
|
||||
public string ReleaseDate { get; set; } = string.Empty;
|
||||
public BookView() {}
|
||||
public BookView(IBook book)
|
||||
{
|
||||
Id = book.Id;
|
||||
Name = book.Name;
|
||||
BookCover = book.BookCover;
|
||||
Author = book.Author;
|
||||
ReleaseDate = book.ReleaseDate;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user