diff --git a/Polyclinic/PolyclinicContracts/BindingModels/DiagnosisBindingModel.cs b/Polyclinic/PolyclinicContracts/BindingModels/DiagnosisBindingModel.cs index 9d936df..6827d46 100644 --- a/Polyclinic/PolyclinicContracts/BindingModels/DiagnosisBindingModel.cs +++ b/Polyclinic/PolyclinicContracts/BindingModels/DiagnosisBindingModel.cs @@ -6,7 +6,7 @@ namespace PolyclinicContracts.BindingModels { public string Name { get; set; } = string.Empty; public string Comment { get; set; } = string.Empty; - public int ExecutorId { get; set; } + public int UserId { get; set; } public int Id { get; set; } } } diff --git a/Polyclinic/PolyclinicContracts/BindingModels/ExecutorBindingModel.cs b/Polyclinic/PolyclinicContracts/BindingModels/UserBindingModel.cs similarity index 57% rename from Polyclinic/PolyclinicContracts/BindingModels/ExecutorBindingModel.cs rename to Polyclinic/PolyclinicContracts/BindingModels/UserBindingModel.cs index f97a6fe..9b66a0d 100644 --- a/Polyclinic/PolyclinicContracts/BindingModels/ExecutorBindingModel.cs +++ b/Polyclinic/PolyclinicContracts/BindingModels/UserBindingModel.cs @@ -1,12 +1,14 @@ -using PolyclinicDataModels.Models; +using PolyclinicDataModels.Enums; +using PolyclinicDataModels.Models; namespace PolyclinicContracts.BindingModels { - public class ExecutorBindingModel : IExecutorModel + public class UserBindingModel : IUserModel { public string FIO { get; set; } = string.Empty; public string Email { get; set; } = string.Empty; public string Password { get; set; } = string.Empty; + public UserRole Role { get; set; } = UserRole.Неизвестный; public int Id { get; set; } } } diff --git a/Polyclinic/PolyclinicContracts/BusinessLogicsContracts/IExecutorLogic.cs b/Polyclinic/PolyclinicContracts/BusinessLogicsContracts/IExecutorLogic.cs deleted file mode 100644 index 59e4d22..0000000 --- a/Polyclinic/PolyclinicContracts/BusinessLogicsContracts/IExecutorLogic.cs +++ /dev/null @@ -1,15 +0,0 @@ -using PolyclinicContracts.BindingModels; -using PolyclinicContracts.SearchModels; -using PolyclinicContracts.ViewModels; - -namespace PolyclinicContracts.BusinessLogicsContracts -{ - public interface IExecutorLogic - { - List? ReadList(ExecutorSearchModel? model); - ExecutorViewModel? ReadElement(ExecutorSearchModel model); - bool Create(ExecutorBindingModel model); - bool Update(ExecutorBindingModel model); - bool Delete(ExecutorBindingModel model); - } -} diff --git a/Polyclinic/PolyclinicContracts/BusinessLogicsContracts/IUserLogic.cs b/Polyclinic/PolyclinicContracts/BusinessLogicsContracts/IUserLogic.cs new file mode 100644 index 0000000..7be0b9b --- /dev/null +++ b/Polyclinic/PolyclinicContracts/BusinessLogicsContracts/IUserLogic.cs @@ -0,0 +1,15 @@ +using PolyclinicContracts.BindingModels; +using PolyclinicContracts.SearchModels; +using PolyclinicContracts.ViewModels; + +namespace PolyclinicContracts.BusinessLogicsContracts +{ + public interface IUserLogic + { + List? ReadList(UserSearchModel? model); + UserViewModel? ReadElement(UserSearchModel model); + bool Create(UserBindingModel model); + bool Update(UserBindingModel model); + bool Delete(UserBindingModel model); + } +} diff --git a/Polyclinic/PolyclinicContracts/SearchModels/DiagnosisSearchModel.cs b/Polyclinic/PolyclinicContracts/SearchModels/DiagnosisSearchModel.cs index 812bfa3..03435b6 100644 --- a/Polyclinic/PolyclinicContracts/SearchModels/DiagnosisSearchModel.cs +++ b/Polyclinic/PolyclinicContracts/SearchModels/DiagnosisSearchModel.cs @@ -3,6 +3,6 @@ public class DiagnosisSearchModel { public int? Id { get; set; } - public int? ExecutorId { get; set; } + public int? UserId { get; set; } } } diff --git a/Polyclinic/PolyclinicContracts/SearchModels/ExecutorSearchModel.cs b/Polyclinic/PolyclinicContracts/SearchModels/UserSearchModel.cs similarity index 83% rename from Polyclinic/PolyclinicContracts/SearchModels/ExecutorSearchModel.cs rename to Polyclinic/PolyclinicContracts/SearchModels/UserSearchModel.cs index 872b783..00ec1f2 100644 --- a/Polyclinic/PolyclinicContracts/SearchModels/ExecutorSearchModel.cs +++ b/Polyclinic/PolyclinicContracts/SearchModels/UserSearchModel.cs @@ -1,6 +1,6 @@ namespace PolyclinicContracts.SearchModels { - public class ExecutorSearchModel + public class UserSearchModel { public int? Id { get; set; } public string? Email { get; set; } diff --git a/Polyclinic/PolyclinicContracts/StoragesContracts/IExecutorStorage.cs b/Polyclinic/PolyclinicContracts/StoragesContracts/IExecutorStorage.cs deleted file mode 100644 index 331af33..0000000 --- a/Polyclinic/PolyclinicContracts/StoragesContracts/IExecutorStorage.cs +++ /dev/null @@ -1,16 +0,0 @@ -using PolyclinicContracts.BindingModels; -using PolyclinicContracts.SearchModels; -using PolyclinicContracts.ViewModels; - -namespace PolyclinicContracts.StoragesContracts -{ - public interface IExecutorStorage - { - List GetFullList(); - List GetFilteredList(ExecutorSearchModel model); - ExecutorViewModel? GetElement(ExecutorSearchModel model); - ExecutorViewModel? Insert(ExecutorBindingModel model); - ExecutorViewModel? Update(ExecutorBindingModel model); - ExecutorViewModel? Delete(ExecutorBindingModel model); - } -} diff --git a/Polyclinic/PolyclinicContracts/StoragesContracts/IUserStorage.cs b/Polyclinic/PolyclinicContracts/StoragesContracts/IUserStorage.cs new file mode 100644 index 0000000..810fee5 --- /dev/null +++ b/Polyclinic/PolyclinicContracts/StoragesContracts/IUserStorage.cs @@ -0,0 +1,16 @@ +using PolyclinicContracts.BindingModels; +using PolyclinicContracts.SearchModels; +using PolyclinicContracts.ViewModels; + +namespace PolyclinicContracts.StoragesContracts +{ + public interface IUserStorage + { + List GetFullList(); + List GetFilteredList(UserSearchModel model); + UserViewModel? GetElement(UserSearchModel model); + UserViewModel? Insert(UserBindingModel model); + UserViewModel? Update(UserBindingModel model); + UserViewModel? Delete(UserBindingModel model); + } +} diff --git a/Polyclinic/PolyclinicContracts/ViewModels/DiagnosisViewModel.cs b/Polyclinic/PolyclinicContracts/ViewModels/DiagnosisViewModel.cs index 10f4d44..8140660 100644 --- a/Polyclinic/PolyclinicContracts/ViewModels/DiagnosisViewModel.cs +++ b/Polyclinic/PolyclinicContracts/ViewModels/DiagnosisViewModel.cs @@ -9,7 +9,7 @@ namespace PolyclinicContracts.ViewModels public string Name { get; set; } = string.Empty; [DisplayName("Комментарий")] public string Comment { get; set; } = string.Empty; - public int ExecutorId { get; set; } + public int UserId { get; set; } public int Id { get; set; } } } diff --git a/Polyclinic/PolyclinicContracts/ViewModels/ExecutorViewModel.cs b/Polyclinic/PolyclinicContracts/ViewModels/ExecutorViewModel.cs deleted file mode 100644 index 04f492c..0000000 --- a/Polyclinic/PolyclinicContracts/ViewModels/ExecutorViewModel.cs +++ /dev/null @@ -1,15 +0,0 @@ -using PolyclinicDataModels.Models; -using System.ComponentModel; - -namespace PolyclinicContracts.ViewModels -{ - public class ExecutorViewModel : IExecutorModel - { - [DisplayName("ФИО исполнителя")] - public string FIO { get; set; } = string.Empty; - [DisplayName("Email исполнителя")] - public string Email { get; set; } = string.Empty; - public string Password { get; set; } = string.Empty; - public int Id { get; set; } - } -} diff --git a/Polyclinic/PolyclinicContracts/ViewModels/UserViewModel.cs b/Polyclinic/PolyclinicContracts/ViewModels/UserViewModel.cs new file mode 100644 index 0000000..3dece25 --- /dev/null +++ b/Polyclinic/PolyclinicContracts/ViewModels/UserViewModel.cs @@ -0,0 +1,19 @@ +using PolyclinicDataModels.Enums; +using PolyclinicDataModels.Models; +using System.ComponentModel; + +namespace PolyclinicContracts.ViewModels +{ + public class UserViewModel : IUserModel + { + [DisplayName("ФИО")] + public string FIO { get; set; } = string.Empty; + [DisplayName("Email")] + public string Email { get; set; } = string.Empty; + [DisplayName("Пароль")] + public string Password { get; set; } = string.Empty; + [DisplayName("Роль")] + public UserRole Role { get; set; } = UserRole.Неизвестный; + public int Id { get; set; } + } +} diff --git a/Polyclinic/PolyclinicDataModels/Enums/UserRole.cs b/Polyclinic/PolyclinicDataModels/Enums/UserRole.cs new file mode 100644 index 0000000..fbf5684 --- /dev/null +++ b/Polyclinic/PolyclinicDataModels/Enums/UserRole.cs @@ -0,0 +1,10 @@ +namespace PolyclinicDataModels.Enums +{ + public enum UserRole + { + Неизвестный = -1, + Администратор = 0, + Исполнитель = 1, + Поручитель = 2 + } +} diff --git a/Polyclinic/PolyclinicDataModels/Models/IDiagnosisModel.cs b/Polyclinic/PolyclinicDataModels/Models/IDiagnosisModel.cs index 7e23ea8..9a6c0a3 100644 --- a/Polyclinic/PolyclinicDataModels/Models/IDiagnosisModel.cs +++ b/Polyclinic/PolyclinicDataModels/Models/IDiagnosisModel.cs @@ -4,6 +4,6 @@ { string Name { get; } string Comment { get; } - int ExecutorId { get; } + int UserId { get; } } } diff --git a/Polyclinic/PolyclinicDataModels/Models/IExecutorModel.cs b/Polyclinic/PolyclinicDataModels/Models/IExecutorModel.cs deleted file mode 100644 index 44b0365..0000000 --- a/Polyclinic/PolyclinicDataModels/Models/IExecutorModel.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace PolyclinicDataModels.Models -{ - public interface IExecutorModel : IId - { - string FIO { get; } - string Email { get; } - string Password { get; } - } -} diff --git a/Polyclinic/PolyclinicDataModels/Models/ISuretorModel.cs b/Polyclinic/PolyclinicDataModels/Models/ISuretorModel.cs deleted file mode 100644 index e88c68f..0000000 --- a/Polyclinic/PolyclinicDataModels/Models/ISuretorModel.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace PolyclinicDataModels.Models -{ - public interface ISuretorModel : IId - { - string FIO { get; } - string Password { get; } - string Email { get; } - } -} diff --git a/Polyclinic/PolyclinicDataModels/Models/IUserModel.cs b/Polyclinic/PolyclinicDataModels/Models/IUserModel.cs new file mode 100644 index 0000000..cb10e4c --- /dev/null +++ b/Polyclinic/PolyclinicDataModels/Models/IUserModel.cs @@ -0,0 +1,12 @@ +using PolyclinicDataModels.Enums; + +namespace PolyclinicDataModels.Models +{ + public interface IUserModel : IId + { + string FIO { get; } + string Email { get; } + string Password { get; } + UserRole Role { get; } + } +}