работает регистрация, вход, не работает добавление процедур - какая-то ошибка с айдишником клиента

This commit is contained in:
Елена Бакальская 2024-05-29 23:48:37 +04:00
parent 08306f2f4d
commit 0c65969374
7 changed files with 142 additions and 47 deletions

View File

@ -1,7 +1,6 @@
using PolyclinicContracts.BindingModels; using PolyclinicContracts.BindingModels;
using PolyclinicContracts.ViewModels; using PolyclinicContracts.ViewModels;
using PolyclinicDataModels.Models; using PolyclinicDataModels.Models;
using SecuritySystemDatabaseImplement;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
namespace PolyclinicDatabaseImplement.Models namespace PolyclinicDatabaseImplement.Models
@ -25,6 +24,8 @@ namespace PolyclinicDatabaseImplement.Models
public static Procedure? Create(ProcedureBindingModel bindingModel) public static Procedure? Create(ProcedureBindingModel bindingModel)
{ {
if (bindingModel == null) return null;
return new Procedure() return new Procedure()
{ {
Id = bindingModel.Id, Id = bindingModel.Id,
@ -42,6 +43,7 @@ namespace PolyclinicDatabaseImplement.Models
{ {
return; return;
} }
Name = bindingModel.Name; Name = bindingModel.Name;
Comment = bindingModel.Comment; Comment = bindingModel.Comment;
DateStartProcedure = bindingModel.DateStartProcedure; DateStartProcedure = bindingModel.DateStartProcedure;

View File

@ -194,6 +194,11 @@ namespace PolyclinicWebAppSuretor.Controllers
public IActionResult Recipes() public IActionResult Recipes()
{ {
var currentUser = LoginManager.LogginedUser;
if (currentUser == null)
{
return RedirectToAction("Login", "User");
}
List<RecipeViewModel> recipes = _recipeLogic.ReadList(null); List<RecipeViewModel> recipes = _recipeLogic.ReadList(null);
if (recipes == null) if (recipes == null)
{ {
@ -206,6 +211,11 @@ namespace PolyclinicWebAppSuretor.Controllers
[HttpPost] [HttpPost]
public IActionResult CreateRecipe(RecipeModel model, int[] selectedProcedures) public IActionResult CreateRecipe(RecipeModel model, int[] selectedProcedures)
{ {
var currentUser = LoginManager.LogginedUser;
if (currentUser == null)
{
return RedirectToAction("Login", "User");
}
ViewBag.Courses = _courseLogic.ReadList(); ViewBag.Courses = _courseLogic.ReadList();
if (HttpContext.Request.Method == "GET") if (HttpContext.Request.Method == "GET")
{ {
@ -240,6 +250,11 @@ namespace PolyclinicWebAppSuretor.Controllers
[HttpPost] [HttpPost]
public IActionResult EditRecipe(int id, RecipeModel model, int[] selectedProcedures) public IActionResult EditRecipe(int id, RecipeModel model, int[] selectedProcedures)
{ {
var currentUser = LoginManager.LogginedUser;
if (currentUser == null)
{
return RedirectToAction("Login", "User");
}
ViewBag.Courses = _courseLogic.ReadList(); ViewBag.Courses = _courseLogic.ReadList();
if (HttpContext.Request.Method == "GET") if (HttpContext.Request.Method == "GET")
@ -276,6 +291,11 @@ namespace PolyclinicWebAppSuretor.Controllers
[HttpPost] [HttpPost]
public IActionResult DeleteRecipe(int id) public IActionResult DeleteRecipe(int id)
{ {
var currentUser = LoginManager.LogginedUser;
if (currentUser == null)
{
return RedirectToAction("Login", "User");
}
var obj = _recipeLogic.ReadElement(new RecipeSearchModel { Id = id }); var obj = _recipeLogic.ReadElement(new RecipeSearchModel { Id = id });
if (obj != null) if (obj != null)
{ {
@ -291,6 +311,11 @@ namespace PolyclinicWebAppSuretor.Controllers
public IActionResult Medicaments() public IActionResult Medicaments()
{ {
var currentUser = LoginManager.LogginedUser;
if (currentUser == null)
{
return RedirectToAction("Login", "User");
}
List<MedicamentViewModel> medicaments = _medicamentLogic.ReadList(null); List<MedicamentViewModel> medicaments = _medicamentLogic.ReadList(null);
if (medicaments == null) if (medicaments == null)
{ {
@ -303,6 +328,11 @@ namespace PolyclinicWebAppSuretor.Controllers
[HttpPost] [HttpPost]
public IActionResult CreateMedicament(MedicamentViewModel model) public IActionResult CreateMedicament(MedicamentViewModel model)
{ {
var currentUser = LoginManager.LogginedUser;
if (currentUser == null)
{
return RedirectToAction("Login", "User");
}
ViewBag.Procedures = _procedureLogic.ReadList(null); ViewBag.Procedures = _procedureLogic.ReadList(null);
ViewBag.Symptomes = _symptomLogic.ReadList(null); ViewBag.Symptomes = _symptomLogic.ReadList(null);
if (HttpContext.Request.Method == "GET") if (HttpContext.Request.Method == "GET")
@ -329,6 +359,11 @@ namespace PolyclinicWebAppSuretor.Controllers
[HttpPost] [HttpPost]
public IActionResult EditMedicament(MedicamentViewModel model) public IActionResult EditMedicament(MedicamentViewModel model)
{ {
var currentUser = LoginManager.LogginedUser;
if (currentUser == null)
{
return RedirectToAction("Login", "User");
}
ViewBag.Procedures = _procedureLogic.ReadList(null); ViewBag.Procedures = _procedureLogic.ReadList(null);
ViewBag.Symptomes = _symptomLogic.ReadList(null); ViewBag.Symptomes = _symptomLogic.ReadList(null);
if (HttpContext.Request.Method == "GET") if (HttpContext.Request.Method == "GET")
@ -355,6 +390,11 @@ namespace PolyclinicWebAppSuretor.Controllers
[HttpPost] [HttpPost]
public IActionResult DeleteMedicament(int id) public IActionResult DeleteMedicament(int id)
{ {
var currentUser = LoginManager.LogginedUser;
if (currentUser == null)
{
return RedirectToAction("Login", "User");
}
var obj = _medicamentLogic.ReadElement(new MedicamentSearchModel { Id = id }); var obj = _medicamentLogic.ReadElement(new MedicamentSearchModel { Id = id });
if (obj != null) if (obj != null)
{ {
@ -364,8 +404,18 @@ namespace PolyclinicWebAppSuretor.Controllers
} }
/// <summary>
/// PROCEDURES
/// </summary>
/// <returns></returns>
public IActionResult Procedures() public IActionResult Procedures()
{ {
var currentUser = LoginManager.LogginedUser;
if (currentUser == null)
{
return RedirectToAction("Login", "User");
}
List<ProcedureViewModel> procedure = _procedureLogic.ReadList(null); List<ProcedureViewModel> procedure = _procedureLogic.ReadList(null);
if (procedure == null) if (procedure == null)
{ {
@ -378,6 +428,11 @@ namespace PolyclinicWebAppSuretor.Controllers
[HttpPost] [HttpPost]
public IActionResult CreateProcedure(ProcedureViewModel model) public IActionResult CreateProcedure(ProcedureViewModel model)
{ {
var currentUser = LoginManager.LogginedUser;
if (currentUser == null)
{
return RedirectToAction("Login", "User");
}
if (HttpContext.Request.Method == "GET") if (HttpContext.Request.Method == "GET")
{ {
ViewData["Title"] = "Íîâàÿ ïðîöåäóðà"; ViewData["Title"] = "Íîâàÿ ïðîöåäóðà";
@ -389,6 +444,7 @@ namespace PolyclinicWebAppSuretor.Controllers
ProcedureBindingModel procedure = new ProcedureBindingModel ProcedureBindingModel procedure = new ProcedureBindingModel
{ {
Name = model.Name, Name = model.Name,
UserId = model.UserId,
Comment = model.Comment ?? string.Empty, Comment = model.Comment ?? string.Empty,
DateStartProcedure = model.DateStartProcedure, DateStartProcedure = model.DateStartProcedure,
DateStopProcedure = model.DateStopProcedure DateStopProcedure = model.DateStopProcedure
@ -402,6 +458,11 @@ namespace PolyclinicWebAppSuretor.Controllers
[HttpPost] [HttpPost]
public IActionResult EditProcedure(ProcedureViewModel model) public IActionResult EditProcedure(ProcedureViewModel model)
{ {
var currentUser = LoginManager.LogginedUser;
if (currentUser == null)
{
return RedirectToAction("Login", "User");
}
if (HttpContext.Request.Method == "GET") if (HttpContext.Request.Method == "GET")
{ {
var obj = _procedureLogic.ReadElement(new ProcedureSearchModel { Id = model.Id }); var obj = _procedureLogic.ReadElement(new ProcedureSearchModel { Id = model.Id });
@ -415,6 +476,7 @@ namespace PolyclinicWebAppSuretor.Controllers
Id = model.Id, Id = model.Id,
Name = model.Name, Name = model.Name,
Comment = model.Comment, Comment = model.Comment,
UserId = model.UserId,
DateStartProcedure = model.DateStartProcedure, DateStartProcedure = model.DateStartProcedure,
DateStopProcedure = model.DateStopProcedure DateStopProcedure = model.DateStopProcedure
}; };
@ -426,6 +488,11 @@ namespace PolyclinicWebAppSuretor.Controllers
[HttpPost] [HttpPost]
public IActionResult DeleteProcedure(int id) public IActionResult DeleteProcedure(int id)
{ {
var currentUser = LoginManager.LogginedUser;
if (currentUser == null)
{
return RedirectToAction("Login", "User");
}
var obj = _procedureLogic.ReadElement(new ProcedureSearchModel { Id = id }); var obj = _procedureLogic.ReadElement(new ProcedureSearchModel { Id = id });
if (obj != null) if (obj != null)
{ {
@ -434,10 +501,13 @@ namespace PolyclinicWebAppSuretor.Controllers
return RedirectToAction("Procedures"); return RedirectToAction("Procedures");
} }
public IActionResult AddSymptomToMedicament(AddSymptomToMedicamentModel model) public IActionResult AddSymptomToMedicament(AddSymptomToMedicamentModel model)
{ {
var currentUser = LoginManager.LogginedUser;
if (currentUser == null)
{
return RedirectToAction("Login", "User");
}
model = new() model = new()
{ {
Medicaments = _medicamentLogic.ReadList(null), Medicaments = _medicamentLogic.ReadList(null),
@ -448,6 +518,11 @@ namespace PolyclinicWebAppSuretor.Controllers
public IActionResult ListCoursesByProcedures() public IActionResult ListCoursesByProcedures()
{ {
var currentUser = LoginManager.LogginedUser;
if (currentUser == null)
{
return RedirectToAction("Login", "User");
}
ViewBag.Procedures = _procedureLogic.ReadList(null); ViewBag.Procedures = _procedureLogic.ReadList(null);
return View(); return View();
} }
@ -455,6 +530,11 @@ namespace PolyclinicWebAppSuretor.Controllers
[HttpPost] [HttpPost]
public IActionResult CreateWordFile(int procedureId, string fileName, string fileFormat) public IActionResult CreateWordFile(int procedureId, string fileName, string fileFormat)
{ {
var currentUser = LoginManager.LogginedUser;
if (currentUser == null)
{
return RedirectToAction("Login", "User");
}
var procedure = _procedureLogic.ReadElement(new ProcedureSearchModel { Id = procedureId }); var procedure = _procedureLogic.ReadElement(new ProcedureSearchModel { Id = procedureId });
ViewBag.Procedures = procedure; ViewBag.Procedures = procedure;
@ -495,14 +575,24 @@ namespace PolyclinicWebAppSuretor.Controllers
/// <returns></returns> /// <returns></returns>
[HttpGet] [HttpGet]
/*public IActionResult ProceduresReport() public IActionResult ProceduresReport()
{ {
var currentUser = LoginManager.LogginedUser;
if (currentUser == null)
{
return RedirectToAction("Login", "User");
}
return View(new List<ReportProceduresViewModel>()); return View(new List<ReportProceduresViewModel>());
}*/ }
[HttpPost] [HttpPost]
public IActionResult ProceduresReport(DateTime? dateFrom, DateTime? dateTo, string reportType) public IActionResult ProceduresReport(DateTime? dateFrom, DateTime? dateTo, string reportType)
{ {
var currentUser = LoginManager.LogginedUser;
if (currentUser == null)
{
return RedirectToAction("Login", "User");
}
if (reportType == "form") if (reportType == "form")
{ {
var proceduresReport = _suretorReportLogic.GetProceduresByMedicametsAndSymptoms(); var proceduresReport = _suretorReportLogic.GetProceduresByMedicametsAndSymptoms();
@ -543,22 +633,6 @@ namespace PolyclinicWebAppSuretor.Controllers
} }
} }
[HttpGet]
[HttpPost]
public IActionResult Login()
{
if (HttpContext.Request.Method == "POST")
{
// êàêèå-òî äåéñòâèÿ ïðè íàæàòèè êíîïêè âõîäà
return View();
}
else
{
return View();
}
}
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error() public IActionResult Error()
{ {

View File

@ -10,9 +10,9 @@ namespace PolyclinicWebAppSuretor
public static (string Url, string Title, PageVisible Visible) Recipes = ("Recipes", "Рецепты", 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) Login = ("Login", "Вход", PageVisible.AllowOnlyNotAuthorized);
public static (string Url, string Title, PageVisible Visible) Register = ("Register", "Регистрация", 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) AddSymptomToMedicament = ("AddSymptomToMedicament", "Привязка симптома", PageVisible.AllowOnlyAuthorized);
public static (string Url, string Title, PageVisible Visible) ProceduresReport = ("ProceduresReport", "Отчет по процедурам", 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) ListCoursesByProcedures = ("ListCoursesByProcedures", "Список курсов", PageVisible.AllowOnlyAuthorized);
public static (string Url, string Title, PageVisible Visible) Privacy = ("Privacy", "Личный кабинет", PageVisible.AllowOnlyAuthorized); public static (string Url, string Title, PageVisible Visible) Privacy = ("Privacy", "Личный кабинет", PageVisible.AllowOnlyAuthorized);
public static List<(string Url, string Title, PageVisible Visible)> MenuItemsOrder = new List<(string Url, string Title, PageVisible Visible)> public static List<(string Url, string Title, PageVisible Visible)> MenuItemsOrder = new List<(string Url, string Title, PageVisible Visible)>

View File

@ -4,11 +4,8 @@
<div class="text-center d-flex flex-column"> <div class="text-center d-flex flex-column">
<div class="d-flex flex-row"> <div class="d-flex flex-row">
<h1 class="display-4 mb-5 me-3">Привет, недобро пожаловать >:\</h1> <h1 class="text-center display-4 mb-5 me-3">Привет, недобро пожаловать >:\</h1>
<a asp-action="Login" class="button-entrance btn">
Ну заходи что-ли...
</a>
@* <input type="submit" value="Ну заходи что-ли..." class="button-entrance btn" asp-action="Login" /> *@
</div> </div>
<div class="text-center d-flex flex-column justify-content-center align-items-center mt-5" style="position: fixed; top: 0; right: 0; bottom: 0; left: 0;"> <div class="text-center d-flex flex-column justify-content-center align-items-center mt-5" style="position: fixed; top: 0; right: 0; bottom: 0; left: 0;">

View File

@ -1,6 +1,6 @@
@using PolyclinicContracts.ViewModels @using PolyclinicContracts.ViewModels
@model List<MedicamentViewModel> @model List<MedicamentViewModel>
@ViewData["Title"] = "Medicaments"; @ViewData["Title"]
<div class="text-center"> <div class="text-center">
<h1 class="display-4">Препараты</h1> <h1 class="display-4">Препараты</h1>

View File

@ -2,38 +2,38 @@
@{ @{
ViewBag.SelectedSiteMenuItem = SiteMenuItems.Register; ViewBag.SelectedSiteMenuItem = SiteMenuItems.Register;
} }
<div class="d-flex w-100 h-100 align-content-center justify-content-center align-items-center mt-5 pt-5"> <div class="d-flex w-100 h-100 align-content-center justify-content-center">
<form class="d-flex flex-column border border-success border-3 rounded-3 p-5" id="loginForm" method="post"> <form class="d-flex flex-column" id="registerForm" method="post">
<h4>Регистрация</h4> <h4>Регистрация исполнителя</h4>
@foreach (var item in Model.Errors) @foreach (var item in Model.Errors)
{ {
<div class="alert alert-danger" role="alert"> <div class="alert alert-danger" role="alert">
@item @item
</div> </div>
} }
<div class="d-flex mb-3"> <div class="mb-2 d-flex w-100">
<label for="fioInput" class="pe-3 w-25"> <label for="fioInput" class="me-2">
ФИО ФИО
</label> </label>
<input class="w-100" type="text" name="fio" id="fioInput" placeholder="Иванов Иван Иванович" asp-for="FIO" /> <input id="fioInput" required asp-for="FIO" placeholder="Иванов Иван Иванович" class="w-100" />
</div> </div>
<div class="d-flex mb-3"> <div class="mb-2 d-flex w-100">
<label for="emailInput" class="pe-3 w-25"> <label for="emailInput" class="me-2">
Email Email
</label> </label>
<input class="w-100" type="email" name="email" id="emailInput" placeholder="mail@example.com" asp-for="Email" /> <input id="emailInput" required type="email" asp-for="Email" placeholder="mail@example.com" class="w-100" />
</div> </div>
<div class="d-flex mb-3"> <div class="mb-2 d-flex w-100">
<label for="passwordInput" class="pe-3 w-50"> <label for="passwordInput" class="me-2">
Пароль Пароль
</label> </label>
<input class="w-100" type="password" name="password" id="passwordInput" asp-for="Password" /> <input id="passwordInput" required type="password" asp-for="Password" class="w-100" />
</div> </div>
<div class="d-flex mb-3"> <div class="mb-2 d-flex w-100">
<label for="passwordConfirm" class="pe-3 w-50"> <label for="confirmPasswordInput" class="me-2">
Подверждение пароля Повторите пароль
</label> </label>
<input class="w-100" type="password" name="passwordConfirm" id="passwordConfirm" asp-for="ConfirmPassword" /> <input id="confirmPasswordInput" required type="password" asp-for="ConfirmPassword" class="w-100" />
</div> </div>
<button class="btn btn-outline-success" type="submit"> <button class="btn btn-outline-success" type="submit">
Зарегистрироваться Зарегистрироваться

View File

@ -0,0 +1,22 @@
<svg width="1034" height="1034" viewBox="0 0 1034 1034" fill="none" xmlns="http://www.w3.org/2000/svg">
<g filter="url(#filter0_d_7_194)">
<path d="M771.806 264.377L262.097 771.984" stroke="#CD3737" stroke-opacity="0.66" stroke-width="150" stroke-linecap="round"/>
<path d="M262.319 260.823L772.423 773.039" stroke="#CD3737" stroke-opacity="0.66" stroke-width="150" stroke-linecap="round"/>
</g>
<path d="M272.068 189V836.5C413 858.5 562.75 576.274 307.5 502" stroke="black" stroke-width="25" stroke-linecap="round"/>
<path opacity="0.3" d="M262 213V858.93C456.707 873.33 571.316 587.613 305.623 511.5" stroke="#BD3A3A" stroke-width="25" stroke-linecap="round"/>
<path d="M166.109 315.766L846.026 315.766" stroke="black" stroke-width="25" stroke-linecap="round"/>
<path opacity="0.3" d="M151 313L853 315.716" stroke="#BD3A3A" stroke-width="25" stroke-linecap="round"/>
<defs>
<filter id="filter0_d_7_194" x="172.096" y="170.823" width="720.326" height="722.216" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset dx="15" dy="15"/>
<feGaussianBlur stdDeviation="15"/>
<feComposite in2="hardAlpha" operator="out"/>
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"/>
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_7_194"/>
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_7_194" result="shape"/>
</filter>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 1.6 KiB