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

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.ViewModels;
using PolyclinicDataModels.Models;
using SecuritySystemDatabaseImplement;
using System.ComponentModel.DataAnnotations;
namespace PolyclinicDatabaseImplement.Models
@ -25,6 +24,8 @@ namespace PolyclinicDatabaseImplement.Models
public static Procedure? Create(ProcedureBindingModel bindingModel)
{
if (bindingModel == null) return null;
return new Procedure()
{
Id = bindingModel.Id,
@ -38,10 +39,11 @@ namespace PolyclinicDatabaseImplement.Models
public void Update(ProcedureBindingModel? bindingModel)
{
if (bindingModel == null)
if (bindingModel == null)
{
return;
}
Name = bindingModel.Name;
Comment = bindingModel.Comment;
DateStartProcedure = bindingModel.DateStartProcedure;
@ -56,6 +58,6 @@ namespace PolyclinicDatabaseImplement.Models
Comment = Comment,
DateStartProcedure = DateStartProcedure,
DateStopProcedure = DateStopProcedure,
};
};
}
}

View File

@ -194,6 +194,11 @@ namespace PolyclinicWebAppSuretor.Controllers
public IActionResult Recipes()
{
var currentUser = LoginManager.LogginedUser;
if (currentUser == null)
{
return RedirectToAction("Login", "User");
}
List<RecipeViewModel> recipes = _recipeLogic.ReadList(null);
if (recipes == null)
{
@ -206,6 +211,11 @@ namespace PolyclinicWebAppSuretor.Controllers
[HttpPost]
public IActionResult CreateRecipe(RecipeModel model, int[] selectedProcedures)
{
var currentUser = LoginManager.LogginedUser;
if (currentUser == null)
{
return RedirectToAction("Login", "User");
}
ViewBag.Courses = _courseLogic.ReadList();
if (HttpContext.Request.Method == "GET")
{
@ -240,6 +250,11 @@ namespace PolyclinicWebAppSuretor.Controllers
[HttpPost]
public IActionResult EditRecipe(int id, RecipeModel model, int[] selectedProcedures)
{
var currentUser = LoginManager.LogginedUser;
if (currentUser == null)
{
return RedirectToAction("Login", "User");
}
ViewBag.Courses = _courseLogic.ReadList();
if (HttpContext.Request.Method == "GET")
@ -276,6 +291,11 @@ namespace PolyclinicWebAppSuretor.Controllers
[HttpPost]
public IActionResult DeleteRecipe(int id)
{
var currentUser = LoginManager.LogginedUser;
if (currentUser == null)
{
return RedirectToAction("Login", "User");
}
var obj = _recipeLogic.ReadElement(new RecipeSearchModel { Id = id });
if (obj != null)
{
@ -291,6 +311,11 @@ namespace PolyclinicWebAppSuretor.Controllers
public IActionResult Medicaments()
{
var currentUser = LoginManager.LogginedUser;
if (currentUser == null)
{
return RedirectToAction("Login", "User");
}
List<MedicamentViewModel> medicaments = _medicamentLogic.ReadList(null);
if (medicaments == null)
{
@ -303,6 +328,11 @@ namespace PolyclinicWebAppSuretor.Controllers
[HttpPost]
public IActionResult CreateMedicament(MedicamentViewModel model)
{
var currentUser = LoginManager.LogginedUser;
if (currentUser == null)
{
return RedirectToAction("Login", "User");
}
ViewBag.Procedures = _procedureLogic.ReadList(null);
ViewBag.Symptomes = _symptomLogic.ReadList(null);
if (HttpContext.Request.Method == "GET")
@ -329,6 +359,11 @@ namespace PolyclinicWebAppSuretor.Controllers
[HttpPost]
public IActionResult EditMedicament(MedicamentViewModel model)
{
var currentUser = LoginManager.LogginedUser;
if (currentUser == null)
{
return RedirectToAction("Login", "User");
}
ViewBag.Procedures = _procedureLogic.ReadList(null);
ViewBag.Symptomes = _symptomLogic.ReadList(null);
if (HttpContext.Request.Method == "GET")
@ -355,6 +390,11 @@ namespace PolyclinicWebAppSuretor.Controllers
[HttpPost]
public IActionResult DeleteMedicament(int id)
{
var currentUser = LoginManager.LogginedUser;
if (currentUser == null)
{
return RedirectToAction("Login", "User");
}
var obj = _medicamentLogic.ReadElement(new MedicamentSearchModel { Id = id });
if (obj != null)
{
@ -364,8 +404,18 @@ namespace PolyclinicWebAppSuretor.Controllers
}
/// <summary>
/// PROCEDURES
/// </summary>
/// <returns></returns>
public IActionResult Procedures()
{
var currentUser = LoginManager.LogginedUser;
if (currentUser == null)
{
return RedirectToAction("Login", "User");
}
List<ProcedureViewModel> procedure = _procedureLogic.ReadList(null);
if (procedure == null)
{
@ -378,6 +428,11 @@ namespace PolyclinicWebAppSuretor.Controllers
[HttpPost]
public IActionResult CreateProcedure(ProcedureViewModel model)
{
var currentUser = LoginManager.LogginedUser;
if (currentUser == null)
{
return RedirectToAction("Login", "User");
}
if (HttpContext.Request.Method == "GET")
{
ViewData["Title"] = "Íîâàÿ ïðîöåäóðà";
@ -389,6 +444,7 @@ namespace PolyclinicWebAppSuretor.Controllers
ProcedureBindingModel procedure = new ProcedureBindingModel
{
Name = model.Name,
UserId = model.UserId,
Comment = model.Comment ?? string.Empty,
DateStartProcedure = model.DateStartProcedure,
DateStopProcedure = model.DateStopProcedure
@ -402,6 +458,11 @@ namespace PolyclinicWebAppSuretor.Controllers
[HttpPost]
public IActionResult EditProcedure(ProcedureViewModel model)
{
var currentUser = LoginManager.LogginedUser;
if (currentUser == null)
{
return RedirectToAction("Login", "User");
}
if (HttpContext.Request.Method == "GET")
{
var obj = _procedureLogic.ReadElement(new ProcedureSearchModel { Id = model.Id });
@ -415,6 +476,7 @@ namespace PolyclinicWebAppSuretor.Controllers
Id = model.Id,
Name = model.Name,
Comment = model.Comment,
UserId = model.UserId,
DateStartProcedure = model.DateStartProcedure,
DateStopProcedure = model.DateStopProcedure
};
@ -426,6 +488,11 @@ namespace PolyclinicWebAppSuretor.Controllers
[HttpPost]
public IActionResult DeleteProcedure(int id)
{
var currentUser = LoginManager.LogginedUser;
if (currentUser == null)
{
return RedirectToAction("Login", "User");
}
var obj = _procedureLogic.ReadElement(new ProcedureSearchModel { Id = id });
if (obj != null)
{
@ -434,10 +501,13 @@ namespace PolyclinicWebAppSuretor.Controllers
return RedirectToAction("Procedures");
}
public IActionResult AddSymptomToMedicament(AddSymptomToMedicamentModel model)
{
var currentUser = LoginManager.LogginedUser;
if (currentUser == null)
{
return RedirectToAction("Login", "User");
}
model = new()
{
Medicaments = _medicamentLogic.ReadList(null),
@ -448,6 +518,11 @@ namespace PolyclinicWebAppSuretor.Controllers
public IActionResult ListCoursesByProcedures()
{
var currentUser = LoginManager.LogginedUser;
if (currentUser == null)
{
return RedirectToAction("Login", "User");
}
ViewBag.Procedures = _procedureLogic.ReadList(null);
return View();
}
@ -455,6 +530,11 @@ namespace PolyclinicWebAppSuretor.Controllers
[HttpPost]
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 });
ViewBag.Procedures = procedure;
@ -495,14 +575,24 @@ namespace PolyclinicWebAppSuretor.Controllers
/// <returns></returns>
[HttpGet]
/*public IActionResult ProceduresReport()
public IActionResult ProceduresReport()
{
var currentUser = LoginManager.LogginedUser;
if (currentUser == null)
{
return RedirectToAction("Login", "User");
}
return View(new List<ReportProceduresViewModel>());
}*/
}
[HttpPost]
public IActionResult ProceduresReport(DateTime? dateFrom, DateTime? dateTo, string reportType)
{
var currentUser = LoginManager.LogginedUser;
if (currentUser == null)
{
return RedirectToAction("Login", "User");
}
if (reportType == "form")
{
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)]
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) 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) 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) ListCoursesByProcedures = ("ListCoursesByProcedures", "Список курсов", 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)>

View File

@ -4,11 +4,8 @@
<div class="text-center d-flex flex-column">
<div class="d-flex flex-row">
<h1 class="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" /> *@
<h1 class="text-center display-4 mb-5 me-3">Привет, недобро пожаловать >:\</h1>
</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;">

View File

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

View File

@ -2,38 +2,38 @@
@{
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">
<form class="d-flex flex-column border border-success border-3 rounded-3 p-5" id="loginForm" method="post">
<h4>Регистрация</h4>
<div class="d-flex w-100 h-100 align-content-center justify-content-center">
<form class="d-flex flex-column" id="registerForm" method="post">
<h4>Регистрация исполнителя</h4>
@foreach (var item in Model.Errors)
{
<div class="alert alert-danger" role="alert">
@item
</div>
}
<div class="d-flex mb-3">
<label for="fioInput" class="pe-3 w-25">
<div class="mb-2 d-flex w-100">
<label for="fioInput" class="me-2">
ФИО
</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 class="d-flex mb-3">
<label for="emailInput" class="pe-3 w-25">
<div class="mb-2 d-flex w-100">
<label for="emailInput" class="me-2">
Email
</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 class="d-flex mb-3">
<label for="passwordInput" class="pe-3 w-50">
<div class="mb-2 d-flex w-100">
<label for="passwordInput" class="me-2">
Пароль
</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 class="d-flex mb-3">
<label for="passwordConfirm" class="pe-3 w-50">
Подверждение пароля
<div class="mb-2 d-flex w-100">
<label for="confirmPasswordInput" class="me-2">
Повторите пароль
</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>
<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