From bfa38fafb07555627901e11f07fbc0361376c6ce Mon Sep 17 00:00:00 2001 From: abazov73 <92822431+abazov73@users.noreply.github.com> Date: Thu, 16 Nov 2023 19:22:13 +0400 Subject: [PATCH] Lab03: create AccountContracts project --- AbazovApp/AbazovApp.sln | 22 +++++++++++++++++-- .../AccountsContracts.csproj | 13 +++++++++++ .../BindingModels/AccountBindingModel.cs | 20 +++++++++++++++++ .../BindingModels/InterestBindingModel.cs | 16 ++++++++++++++ .../BusinessLogicContracts/IAccountLogic.cs | 20 +++++++++++++++++ .../BusinessLogicContracts/IInterestLogic.cs | 20 +++++++++++++++++ .../SearchModels/AccountSearchModel.cs | 13 +++++++++++ .../SearchModels/InterestSearchModel.cs | 13 +++++++++++ .../StorageContracts/IAccountStrorage.cs | 21 ++++++++++++++++++ .../StorageContracts/IInterestModel.cs | 21 ++++++++++++++++++ .../ViewModels/AccountViewModel.cs | 21 ++++++++++++++++++ .../ViewModels/InterestViewModel.cs | 17 ++++++++++++++ 12 files changed, 215 insertions(+), 2 deletions(-) create mode 100644 AbazovApp/AccountsContracts/AccountsContracts.csproj create mode 100644 AbazovApp/AccountsContracts/BindingModels/AccountBindingModel.cs create mode 100644 AbazovApp/AccountsContracts/BindingModels/InterestBindingModel.cs create mode 100644 AbazovApp/AccountsContracts/BusinessLogicContracts/IAccountLogic.cs create mode 100644 AbazovApp/AccountsContracts/BusinessLogicContracts/IInterestLogic.cs create mode 100644 AbazovApp/AccountsContracts/SearchModels/AccountSearchModel.cs create mode 100644 AbazovApp/AccountsContracts/SearchModels/InterestSearchModel.cs create mode 100644 AbazovApp/AccountsContracts/StorageContracts/IAccountStrorage.cs create mode 100644 AbazovApp/AccountsContracts/StorageContracts/IInterestModel.cs create mode 100644 AbazovApp/AccountsContracts/ViewModels/AccountViewModel.cs create mode 100644 AbazovApp/AccountsContracts/ViewModels/InterestViewModel.cs diff --git a/AbazovApp/AbazovApp.sln b/AbazovApp/AbazovApp.sln index 7b91f4c..434359b 100644 --- a/AbazovApp/AbazovApp.sln +++ b/AbazovApp/AbazovApp.sln @@ -3,9 +3,15 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.3.32825.248 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AbazovAppView", "AbazovAppView\AbazovAppView.csproj", "{D7EF43DC-2F09-4EAD-8161-6D4A08BC7786}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AbazovAppView", "AbazovAppView\AbazovAppView.csproj", "{D7EF43DC-2F09-4EAD-8161-6D4A08BC7786}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AbazovViewComponents", "AbazovViewComponents\AbazovViewComponents.csproj", "{070AAA71-3C9B-4E19-A89D-83372C630C6E}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AbazovViewComponents", "AbazovViewComponents\AbazovViewComponents.csproj", "{070AAA71-3C9B-4E19-A89D-83372C630C6E}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AccountsApp", "AccountsApp\AccountsApp.csproj", "{AFCB57A0-4332-4C32-9FB1-60548F7D7276}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AccountsDataModels", "AccountsDataModels\AccountsDataModels.csproj", "{31DEDC68-889D-427B-ADDE-60F2ADE2C596}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AccountsContracts", "AccountsContracts\AccountsContracts.csproj", "{CDA8B86A-9645-4D83-92D0-C8D2D85B734F}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -21,6 +27,18 @@ Global {070AAA71-3C9B-4E19-A89D-83372C630C6E}.Debug|Any CPU.Build.0 = Debug|Any CPU {070AAA71-3C9B-4E19-A89D-83372C630C6E}.Release|Any CPU.ActiveCfg = Release|Any CPU {070AAA71-3C9B-4E19-A89D-83372C630C6E}.Release|Any CPU.Build.0 = Release|Any CPU + {AFCB57A0-4332-4C32-9FB1-60548F7D7276}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AFCB57A0-4332-4C32-9FB1-60548F7D7276}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AFCB57A0-4332-4C32-9FB1-60548F7D7276}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AFCB57A0-4332-4C32-9FB1-60548F7D7276}.Release|Any CPU.Build.0 = Release|Any CPU + {31DEDC68-889D-427B-ADDE-60F2ADE2C596}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {31DEDC68-889D-427B-ADDE-60F2ADE2C596}.Debug|Any CPU.Build.0 = Debug|Any CPU + {31DEDC68-889D-427B-ADDE-60F2ADE2C596}.Release|Any CPU.ActiveCfg = Release|Any CPU + {31DEDC68-889D-427B-ADDE-60F2ADE2C596}.Release|Any CPU.Build.0 = Release|Any CPU + {CDA8B86A-9645-4D83-92D0-C8D2D85B734F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CDA8B86A-9645-4D83-92D0-C8D2D85B734F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CDA8B86A-9645-4D83-92D0-C8D2D85B734F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CDA8B86A-9645-4D83-92D0-C8D2D85B734F}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/AbazovApp/AccountsContracts/AccountsContracts.csproj b/AbazovApp/AccountsContracts/AccountsContracts.csproj new file mode 100644 index 0000000..7168be6 --- /dev/null +++ b/AbazovApp/AccountsContracts/AccountsContracts.csproj @@ -0,0 +1,13 @@ + + + + net6.0 + enable + enable + + + + + + + diff --git a/AbazovApp/AccountsContracts/BindingModels/AccountBindingModel.cs b/AbazovApp/AccountsContracts/BindingModels/AccountBindingModel.cs new file mode 100644 index 0000000..df2c21d --- /dev/null +++ b/AbazovApp/AccountsContracts/BindingModels/AccountBindingModel.cs @@ -0,0 +1,20 @@ +using AccountsDataModels.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AccountsContracts.BindingModels +{ + public class AccountBindingModel : IAccountModel + { + public string Login { get; set; } = string.Empty; + + public string Password { get; set; } = string.Empty; + + public string Email { get; set; } = string.Empty; + + public int Id { get; set; } + } +} diff --git a/AbazovApp/AccountsContracts/BindingModels/InterestBindingModel.cs b/AbazovApp/AccountsContracts/BindingModels/InterestBindingModel.cs new file mode 100644 index 0000000..e138652 --- /dev/null +++ b/AbazovApp/AccountsContracts/BindingModels/InterestBindingModel.cs @@ -0,0 +1,16 @@ +using AccountsDataModels.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AccountsContracts.BindingModels +{ + public class InterestBindingModel : IInterestModel + { + public string Name { get; set;} = String.Empty; + + public int Id { get; set; } + } +} diff --git a/AbazovApp/AccountsContracts/BusinessLogicContracts/IAccountLogic.cs b/AbazovApp/AccountsContracts/BusinessLogicContracts/IAccountLogic.cs new file mode 100644 index 0000000..51b2549 --- /dev/null +++ b/AbazovApp/AccountsContracts/BusinessLogicContracts/IAccountLogic.cs @@ -0,0 +1,20 @@ +using AccountsContracts.BindingModels; +using AccountsContracts.SearchModels; +using AccountsContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AccountsContracts.BusinessLogicContracts +{ + public interface IAccountLogic + { + List? ReadList(AccountSearchModel? model); + AccountViewModel? ReadElement(AccountSearchModel model); + bool Create(AccountBindingModel model); + bool Update(AccountBindingModel model); + bool Delete(AccountBindingModel model); + } +} diff --git a/AbazovApp/AccountsContracts/BusinessLogicContracts/IInterestLogic.cs b/AbazovApp/AccountsContracts/BusinessLogicContracts/IInterestLogic.cs new file mode 100644 index 0000000..b65f0de --- /dev/null +++ b/AbazovApp/AccountsContracts/BusinessLogicContracts/IInterestLogic.cs @@ -0,0 +1,20 @@ +using AccountsContracts.BindingModels; +using AccountsContracts.SearchModels; +using AccountsContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AccountsContracts.BusinessLogicContracts +{ + public interface IInterestLogic + { + List? ReadList(InterestSearchModel? model); + InterestViewModel? ReadElement(InterestSearchModel model); + bool Create(InterestBindingModel model); + bool Update(InterestBindingModel model); + bool Delete(InterestBindingModel model); + } +} diff --git a/AbazovApp/AccountsContracts/SearchModels/AccountSearchModel.cs b/AbazovApp/AccountsContracts/SearchModels/AccountSearchModel.cs new file mode 100644 index 0000000..1b46cac --- /dev/null +++ b/AbazovApp/AccountsContracts/SearchModels/AccountSearchModel.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AccountsContracts.SearchModels +{ + public class AccountSearchModel + { + public int? Id { get; set; } + } +} diff --git a/AbazovApp/AccountsContracts/SearchModels/InterestSearchModel.cs b/AbazovApp/AccountsContracts/SearchModels/InterestSearchModel.cs new file mode 100644 index 0000000..6bc6616 --- /dev/null +++ b/AbazovApp/AccountsContracts/SearchModels/InterestSearchModel.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AccountsContracts.SearchModels +{ + public class InterestSearchModel + { + public int? Id { get; set; } + } +} diff --git a/AbazovApp/AccountsContracts/StorageContracts/IAccountStrorage.cs b/AbazovApp/AccountsContracts/StorageContracts/IAccountStrorage.cs new file mode 100644 index 0000000..bcc67f2 --- /dev/null +++ b/AbazovApp/AccountsContracts/StorageContracts/IAccountStrorage.cs @@ -0,0 +1,21 @@ +using AccountsContracts.BindingModels; +using AccountsContracts.SearchModels; +using AccountsContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AccountsContracts.StorageContracts +{ + public interface IAccountStrorage + { + List GetFullList(); + List GetFilteredList(AccountSearchModel model); + AccountViewModel? GetElement(AccountSearchModel model); + AccountViewModel? Insert(AccountBindingModel model); + AccountViewModel? Update(AccountBindingModel model); + AccountViewModel? Delete(AccountBindingModel model); + } +} diff --git a/AbazovApp/AccountsContracts/StorageContracts/IInterestModel.cs b/AbazovApp/AccountsContracts/StorageContracts/IInterestModel.cs new file mode 100644 index 0000000..bce76b1 --- /dev/null +++ b/AbazovApp/AccountsContracts/StorageContracts/IInterestModel.cs @@ -0,0 +1,21 @@ +using AccountsContracts.BindingModels; +using AccountsContracts.SearchModels; +using AccountsContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AccountsContracts.StorageContracts +{ + public interface IInterestModel + { + List GetFullList(); + List GetFilteredList(InterestSearchModel model); + InterestViewModel? GetElement(InterestSearchModel model); + InterestViewModel? Insert(InterestBindingModel model); + InterestViewModel? Update(InterestBindingModel model); + InterestViewModel? Delete(InterestBindingModel model); + } +} diff --git a/AbazovApp/AccountsContracts/ViewModels/AccountViewModel.cs b/AbazovApp/AccountsContracts/ViewModels/AccountViewModel.cs new file mode 100644 index 0000000..f9ec6c7 --- /dev/null +++ b/AbazovApp/AccountsContracts/ViewModels/AccountViewModel.cs @@ -0,0 +1,21 @@ +using AccountsDataModels.Models; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AccountsContracts.ViewModels +{ + public class AccountViewModel : IAccountModel + { + [DisplayName("Почта")] + public string Login { get; set; } = string.Empty; + [DisplayName("Пароль")] + public string Password { get; set; } = string.Empty; + [DisplayName("Электронная почта")] + public string Email { get; set; } = string.Empty; + public int Id { get; set; } + } +} diff --git a/AbazovApp/AccountsContracts/ViewModels/InterestViewModel.cs b/AbazovApp/AccountsContracts/ViewModels/InterestViewModel.cs new file mode 100644 index 0000000..6dcdf3b --- /dev/null +++ b/AbazovApp/AccountsContracts/ViewModels/InterestViewModel.cs @@ -0,0 +1,17 @@ +using AccountsDataModels.Models; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AccountsContracts.ViewModels +{ + public class InterestViewModel : IInterestModel + { + [DisplayName("Название")] + public string Name { get; set; } = string.Empty; + public int Id { get; set; } + } +}