diff --git a/Polyclinic/PolyclinicWebAppSuretor/LoginManager.cs b/Polyclinic/PolyclinicWebAppSuretor/LoginManager.cs new file mode 100644 index 0000000..7590620 --- /dev/null +++ b/Polyclinic/PolyclinicWebAppSuretor/LoginManager.cs @@ -0,0 +1,9 @@ +using PolyclinicContracts.ViewModels; + +namespace PolyclinicWebAppSuretor +{ + public class LoginManager + { + public static UserViewModel? LogginedUser { get; set; } + } +} diff --git a/Polyclinic/PolyclinicWebAppSuretor/Models/UserPrivacyModel.cs b/Polyclinic/PolyclinicWebAppSuretor/Models/UserPrivacyModel.cs new file mode 100644 index 0000000..d3990d2 --- /dev/null +++ b/Polyclinic/PolyclinicWebAppSuretor/Models/UserPrivacyModel.cs @@ -0,0 +1,13 @@ +using PolyclinicDataModels.Enums; +using System.ComponentModel; + +namespace PolyclinicWebAppSuretor.Models +{ + public class UserPrivacyModel + { + public int Id { get; set; } + + [DisplayName("Роль")] + public UserRole Role { get; set; } + } +} diff --git a/Polyclinic/PolyclinicWebAppSuretor/RestrictionEnum.cs b/Polyclinic/PolyclinicWebAppSuretor/RestrictionEnum.cs new file mode 100644 index 0000000..881e7ae --- /dev/null +++ b/Polyclinic/PolyclinicWebAppSuretor/RestrictionEnum.cs @@ -0,0 +1,12 @@ +namespace PolyclinicWebAppSuretor +{ + public class RestrictionEnum + { + public enum PageVisible + { + AllowAnyBody = 0, + AllowOnlyAuthorized = 1, + AllowOnlyNotAuthorized = 2, + } + } +} diff --git a/Polyclinic/PolyclinicWebAppSuretor/SiteMenuItems.cs b/Polyclinic/PolyclinicWebAppSuretor/SiteMenuItems.cs index a791e92..6aa0fcc 100644 --- a/Polyclinic/PolyclinicWebAppSuretor/SiteMenuItems.cs +++ b/Polyclinic/PolyclinicWebAppSuretor/SiteMenuItems.cs @@ -1,20 +1,23 @@ -namespace PolyclinicWebAppSuretor +using static PolyclinicWebAppSuretor.RestrictionEnum; + +namespace PolyclinicWebAppSuretor { public static class SiteMenuItems { - public static (string Url, string Title) Index = ("", "Главная"); - public static (string Url, string Title) Medicaments = ("Medicaments", "Лекарства"); - public static (string Url, string Title) Procedures = ("Procedures", "Процедуры"); - public static (string Url, string Title) Recipes = ("Recipes", "Рецепты"); - public static (string Url, string Title) Login = ("Login", "Вход"); - public static (string Url, string Title) Register = ("Register", "Регистрация"); - public static (string Url, string Title) AddSymptomToMedicament = ("AddSymptomToMedicament", "Привязка симптома к лекарству"); - public static (string Url, string Title) ProceduresReport = ("ProceduresReport", "Отчет по процедурам"); - public static (string Url, string Title) ListCoursesByProcedures = ("ListCoursesByProcedures", "Список курсов приема препаратов"); + public static (string Url, string Title, PageVisible Visible) Index = ("", "Главная", PageVisible.AllowAnyBody); + public static (string Url, string Title, PageVisible Visible) Medicaments = ("Medicaments", "Лекарства", PageVisible.AllowOnlyAuthorized); + public static (string Url, string Title, PageVisible Visible) Procedures = ("Procedures", "Процедуры", PageVisible.AllowOnlyAuthorized); + public static (string Url, string Title, PageVisible Visible) Recipes = ("Recipes", "Рецепты", PageVisible.AllowOnlyAuthorized); + public static (string Url, string Title, PageVisible Visible) Login = ("Login", "Вход", PageVisible.AllowOnlyNotAuthorized); + public static (string Url, string Title, PageVisible Visible) Register = ("Register", "Регистрация", PageVisible.AllowOnlyNotAuthorized); + public static (string Url, string Title, PageVisible Visible) AddSymptomToMedicament = ("AddSymptomToMedicament", "Привязка симптома к лекарству", PageVisible.AllowOnlyAuthorized); + public static (string Url, string Title, PageVisible Visible) ProceduresReport = ("ProceduresReport", "Отчет по процедурам", PageVisible.AllowOnlyAuthorized); + public static (string Url, string Title, PageVisible Visible) ListCoursesByProcedures = ("ListCoursesByProcedures", "Список курсов приема препаратов", PageVisible.AllowOnlyAuthorized); + public static (string Url, string Title, PageVisible Visible) Privacy = ("Privacy", "Личный кабинет", PageVisible.AllowOnlyAuthorized); - public static List<(string Url, string Title)> MenuItemsOrder = new List<(string Url, string Title)> + public static List<(string Url, string Title, PageVisible Visible)> MenuItemsOrder = new List<(string Url, string Title, PageVisible Visible)> { - Index, Medicaments, Procedures, Recipes, ListCoursesByProcedures, Login, Register, AddSymptomToMedicament, ProceduresReport + Index, Medicaments, Procedures, Recipes, ListCoursesByProcedures, Login, Register, AddSymptomToMedicament, ProceduresReport, Privacy }; } } diff --git a/Polyclinic/PolyclinicWebAppSuretor/Views/Home/Login.cshtml b/Polyclinic/PolyclinicWebAppSuretor/Views/Home/Login.cshtml index c7e4e0c..02501fc 100644 --- a/Polyclinic/PolyclinicWebAppSuretor/Views/Home/Login.cshtml +++ b/Polyclinic/PolyclinicWebAppSuretor/Views/Home/Login.cshtml @@ -1,9 +1,16 @@ -@{ +@model LoginModel +@{ ViewBag.SelectedSiteMenuItem = SiteMenuItems.Login; }

Вход

+ @foreach (var item in Model.Errors) + { + + }
-