From 1f593736226789507b7ca012e5b6ee69349fe9ed Mon Sep 17 00:00:00 2001 From: Factorino73 Date: Sat, 25 May 2024 23:29:08 +0400 Subject: [PATCH] WebApp / Redesigned the controllers without using RestAPI --- Hospital/Hospital.sln | 6 - .../Implements/MedicineStorage.cs | 2 +- .../Implements/ProcedureStorage.cs | 2 +- .../Implements/RecipeStorage.cs | 2 +- .../Models/Patient.cs | 14 ++- .../Models/Procedure.cs | 5 + .../Models/Recipe.cs | 7 +- .../Controllers/WeatherForecastController.cs | 33 ------ .../HospitalRestApi/HospitalRestApi.csproj | 23 ---- Hospital/HospitalRestApi/Program.cs | 61 ---------- .../Properties/launchSettings.json | 31 ----- Hospital/HospitalRestApi/WeatherForecast.cs | 13 -- .../appsettings.Development.json | 8 -- Hospital/HospitalRestApi/appsettings.json | 9 -- Hospital/HospitalRestApi/log4net.config | 16 --- Hospital/HospitalWebApp/APIClient.cs | 62 ---------- .../Controllers/DiseaseController.cs | 75 ++++++++---- .../Controllers/HomeController.cs | 51 +++++++- .../Controllers/MedicineController.cs | 39 +++--- .../Controllers/PatientController.cs | 111 ++++++++++++++---- .../Controllers/ProcedureController.cs | 76 +++++++----- .../Controllers/RecipeController.cs | 50 ++++++-- Hospital/HospitalWebApp/HospitalWebApp.csproj | 2 + Hospital/HospitalWebApp/Program.cs | 30 ++++- .../Views/Disease/Diseases.cshtml | 2 + .../Home/{MainPage.cshtml => Index.cshtml} | 0 .../HospitalWebApp/Views/Home/Privacy.cshtml | 10 +- .../Views/Medicine/Medicines.cshtml | 2 + .../Views/Patient/CreatePatientRecipe.cshtml | 28 ++++- .../Views/Patient/Patients.cshtml | 4 +- .../Views/Patient/UpdatePatient.cshtml | 2 +- .../Views/Procedure/Procedures.cshtml | 2 + .../Views/Recipe/Recipes.cshtml | 6 +- .../Views/Recipe/UpdateRecipe.cshtml | 2 +- .../Views/Shared/_Layout.cshtml | 14 ++- Hospital/HospitalWebApp/appsettings.json | 4 +- 36 files changed, 410 insertions(+), 394 deletions(-) delete mode 100644 Hospital/HospitalRestApi/Controllers/WeatherForecastController.cs delete mode 100644 Hospital/HospitalRestApi/HospitalRestApi.csproj delete mode 100644 Hospital/HospitalRestApi/Program.cs delete mode 100644 Hospital/HospitalRestApi/Properties/launchSettings.json delete mode 100644 Hospital/HospitalRestApi/WeatherForecast.cs delete mode 100644 Hospital/HospitalRestApi/appsettings.Development.json delete mode 100644 Hospital/HospitalRestApi/appsettings.json delete mode 100644 Hospital/HospitalRestApi/log4net.config rename Hospital/HospitalWebApp/Views/Home/{MainPage.cshtml => Index.cshtml} (100%) diff --git a/Hospital/Hospital.sln b/Hospital/Hospital.sln index 901d387..dfc4593 100644 --- a/Hospital/Hospital.sln +++ b/Hospital/Hospital.sln @@ -13,8 +13,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HospitalBusinessLogics", "H EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HospitalWebApp", "HospitalWebApp\HospitalWebApp.csproj", "{024326F5-A7A5-41B5-9BEB-C1B10A533F23}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HospitalRestApi", "HospitalRestApi\HospitalRestApi.csproj", "{D2449DB4-C819-44F4-8266-4B46CD8F15E2}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -41,10 +39,6 @@ Global {024326F5-A7A5-41B5-9BEB-C1B10A533F23}.Debug|Any CPU.Build.0 = Debug|Any CPU {024326F5-A7A5-41B5-9BEB-C1B10A533F23}.Release|Any CPU.ActiveCfg = Release|Any CPU {024326F5-A7A5-41B5-9BEB-C1B10A533F23}.Release|Any CPU.Build.0 = Release|Any CPU - {D2449DB4-C819-44F4-8266-4B46CD8F15E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D2449DB4-C819-44F4-8266-4B46CD8F15E2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D2449DB4-C819-44F4-8266-4B46CD8F15E2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D2449DB4-C819-44F4-8266-4B46CD8F15E2}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Hospital/HospitalDatabaseImplement/Implements/MedicineStorage.cs b/Hospital/HospitalDatabaseImplement/Implements/MedicineStorage.cs index 0e1c46d..77b0d32 100644 --- a/Hospital/HospitalDatabaseImplement/Implements/MedicineStorage.cs +++ b/Hospital/HospitalDatabaseImplement/Implements/MedicineStorage.cs @@ -124,7 +124,7 @@ namespace HospitalDatabaseImplement.Implements { using var context = new HospitalDatabase(); var medicine = context.Medicines - .FirstOrDefault(x => x.Equals(model.Id)); + .FirstOrDefault(x => x.Id.Equals(model.Id)); if (medicine == null) { return null; diff --git a/Hospital/HospitalDatabaseImplement/Implements/ProcedureStorage.cs b/Hospital/HospitalDatabaseImplement/Implements/ProcedureStorage.cs index a52f21e..88b3b4f 100644 --- a/Hospital/HospitalDatabaseImplement/Implements/ProcedureStorage.cs +++ b/Hospital/HospitalDatabaseImplement/Implements/ProcedureStorage.cs @@ -148,7 +148,7 @@ namespace HospitalDatabaseImplement.Implements var procedure = context.Procedures .Include(x => x.Medicines) .ThenInclude(x => x.Medicine) - .FirstOrDefault(x => x.Equals(model.Id)); + .FirstOrDefault(x => x.Id.Equals(model.Id)); if (procedure == null) { return null; diff --git a/Hospital/HospitalDatabaseImplement/Implements/RecipeStorage.cs b/Hospital/HospitalDatabaseImplement/Implements/RecipeStorage.cs index 56040e9..8c68c73 100644 --- a/Hospital/HospitalDatabaseImplement/Implements/RecipeStorage.cs +++ b/Hospital/HospitalDatabaseImplement/Implements/RecipeStorage.cs @@ -154,7 +154,7 @@ namespace HospitalDatabaseImplement.Implements .Include(x => x.Doctor) .Include(x => x.Medicines) .ThenInclude(x => x.Medicine) - .FirstOrDefault(x => x.Equals(model.Id)); + .FirstOrDefault(x => x.Id.Equals(model.Id)); if (recipe == null) { return null; diff --git a/Hospital/HospitalDatabaseImplement/Models/Patient.cs b/Hospital/HospitalDatabaseImplement/Models/Patient.cs index e1c8fb7..3c9853a 100644 --- a/Hospital/HospitalDatabaseImplement/Models/Patient.cs +++ b/Hospital/HospitalDatabaseImplement/Models/Patient.cs @@ -190,7 +190,12 @@ namespace HospitalDatabaseImplement.Models var patient = context.Patients.First(x => x.Id == Id); foreach (var pr in model.PatientRecipes) { - context.PatientRecipes.Add(new PatientRecipe + if (patientRecipes!.Any(x => x.RecipeId == pr.Key)) + { + continue; + } + + context.PatientRecipes.Add(new PatientRecipe { Patient = patient, Recipe = context.Recipes.First(x => x.Id == pr.Key) @@ -218,7 +223,12 @@ namespace HospitalDatabaseImplement.Models var patient = context.Patients.First(x => x.Id == Id); foreach (var pp in model.PatientProcedures) { - context.PatientProcedures.Add(new PatientProcedure + if (patientProcedures!.Any(x => x.ProcedureId == pp.Key)) + { + continue; + } + + context.PatientProcedures.Add(new PatientProcedure { Patient = patient, Procedure = context.Procedures.First(x => x.Id == pp.Key) diff --git a/Hospital/HospitalDatabaseImplement/Models/Procedure.cs b/Hospital/HospitalDatabaseImplement/Models/Procedure.cs index e937b98..25a326f 100644 --- a/Hospital/HospitalDatabaseImplement/Models/Procedure.cs +++ b/Hospital/HospitalDatabaseImplement/Models/Procedure.cs @@ -131,6 +131,11 @@ namespace HospitalDatabaseImplement.Models var procedure = context.Procedures.First(x => x.Id == Id); foreach (var pm in model.ProcedureMedicines) { + if (procedureMedicines!.Any(x => x.MedicineId == pm.Key)) + { + continue; + } + context.ProcedureMedicines.Add(new ProcedureMedicine { Procedure = procedure, diff --git a/Hospital/HospitalDatabaseImplement/Models/Recipe.cs b/Hospital/HospitalDatabaseImplement/Models/Recipe.cs index db69c0c..9bce2a9 100644 --- a/Hospital/HospitalDatabaseImplement/Models/Recipe.cs +++ b/Hospital/HospitalDatabaseImplement/Models/Recipe.cs @@ -137,7 +137,12 @@ namespace HospitalDatabaseImplement.Models var recipe = context.Recipes.First(x => x.Id == Id); foreach (var rm in model.RecipeMedicines) { - context.RecipeMedicines.Add(new RecipeMedicine + if (recipeMedicines!.Any(x => x.MedicineId == rm.Key)) + { + continue; + } + + context.RecipeMedicines.Add(new RecipeMedicine { Recipe = recipe, Medicine = context.Medicines.First(x => x.Id == rm.Key) diff --git a/Hospital/HospitalRestApi/Controllers/WeatherForecastController.cs b/Hospital/HospitalRestApi/Controllers/WeatherForecastController.cs deleted file mode 100644 index 2369fee..0000000 --- a/Hospital/HospitalRestApi/Controllers/WeatherForecastController.cs +++ /dev/null @@ -1,33 +0,0 @@ -using Microsoft.AspNetCore.Mvc; - -namespace HospitalRestApi.Controllers -{ - [ApiController] - [Route("[controller]")] - public class WeatherForecastController : ControllerBase - { - private static readonly string[] Summaries = new[] - { - "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" - }; - - private readonly ILogger _logger; - - public WeatherForecastController(ILogger logger) - { - _logger = logger; - } - - [HttpGet(Name = "GetWeatherForecast")] - public IEnumerable Get() - { - return Enumerable.Range(1, 5).Select(index => new WeatherForecast - { - Date = DateTime.Now.AddDays(index), - TemperatureC = Random.Shared.Next(-20, 55), - Summary = Summaries[Random.Shared.Next(Summaries.Length)] - }) - .ToArray(); - } - } -} diff --git a/Hospital/HospitalRestApi/HospitalRestApi.csproj b/Hospital/HospitalRestApi/HospitalRestApi.csproj deleted file mode 100644 index da80aa6..0000000 --- a/Hospital/HospitalRestApi/HospitalRestApi.csproj +++ /dev/null @@ -1,23 +0,0 @@ - - - - net6.0 - enable - enable - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - - - - diff --git a/Hospital/HospitalRestApi/Program.cs b/Hospital/HospitalRestApi/Program.cs deleted file mode 100644 index e5ad895..0000000 --- a/Hospital/HospitalRestApi/Program.cs +++ /dev/null @@ -1,61 +0,0 @@ -using HospitalBusinessLogics.BusinessLogics; -using HospitalBusinessLogics.OfficePackage.Implements; -using HospitalBusinessLogics.OfficePackage; -using HospitalContracts.BusinessLogicsContracts; -using HospitalContracts.StoragesContracts; -using HospitalDatabaseImplement.Implements; -using Microsoft.OpenApi.Models; - -var builder = WebApplication.CreateBuilder(args); - -// Add services to the container. -// Logger service -builder.Logging.SetMinimumLevel(LogLevel.Trace); -builder.Logging.AddLog4Net("log4net.config"); - -// Storage services -builder.Services.AddTransient(); -builder.Services.AddTransient(); -builder.Services.AddTransient(); -builder.Services.AddTransient(); -builder.Services.AddTransient(); -builder.Services.AddTransient(); - -// BusinessLogic services -builder.Services.AddTransient(); -builder.Services.AddTransient(); -builder.Services.AddTransient(); -builder.Services.AddTransient(); -builder.Services.AddTransient(); -builder.Services.AddTransient(); - -// BusinessLogic Reports services -builder.Services.AddTransient(); -builder.Services.AddTransient(); -builder.Services.AddTransient(); -builder.Services.AddTransient(); - -builder.Services.AddControllers(); -// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle -builder.Services.AddEndpointsApiExplorer(); -builder.Services.AddSwaggerGen(c => -{ - c.SwaggerDoc("v1", new OpenApiInfo { Title = "HospitalRestApi", Version = "v1" }); -}); - -var app = builder.Build(); - -// Configure the HTTP request pipeline. -if (app.Environment.IsDevelopment()) -{ - app.UseSwagger(); - app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "HospitalRestApi v1")); -} - -app.UseHttpsRedirection(); - -app.UseAuthorization(); - -app.MapControllers(); - -app.Run(); diff --git a/Hospital/HospitalRestApi/Properties/launchSettings.json b/Hospital/HospitalRestApi/Properties/launchSettings.json deleted file mode 100644 index 322dfa3..0000000 --- a/Hospital/HospitalRestApi/Properties/launchSettings.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "$schema": "https://json.schemastore.org/launchsettings.json", - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:20442", - "sslPort": 44332 - } - }, - "profiles": { - "HospitalRestApi": { - "commandName": "Project", - "dotnetRunMessages": true, - "launchBrowser": true, - "launchUrl": "swagger", - "applicationUrl": "https://localhost:7267;http://localhost:5235", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "launchUrl": "swagger", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - } - } -} diff --git a/Hospital/HospitalRestApi/WeatherForecast.cs b/Hospital/HospitalRestApi/WeatherForecast.cs deleted file mode 100644 index 393c7f4..0000000 --- a/Hospital/HospitalRestApi/WeatherForecast.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace HospitalRestApi -{ - public class WeatherForecast - { - public DateTime Date { get; set; } - - public int TemperatureC { get; set; } - - public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); - - public string? Summary { get; set; } - } -} diff --git a/Hospital/HospitalRestApi/appsettings.Development.json b/Hospital/HospitalRestApi/appsettings.Development.json deleted file mode 100644 index 0c208ae..0000000 --- a/Hospital/HospitalRestApi/appsettings.Development.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.AspNetCore": "Warning" - } - } -} diff --git a/Hospital/HospitalRestApi/appsettings.json b/Hospital/HospitalRestApi/appsettings.json deleted file mode 100644 index 10f68b8..0000000 --- a/Hospital/HospitalRestApi/appsettings.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.AspNetCore": "Warning" - } - }, - "AllowedHosts": "*" -} diff --git a/Hospital/HospitalRestApi/log4net.config b/Hospital/HospitalRestApi/log4net.config deleted file mode 100644 index 3df86b0..0000000 --- a/Hospital/HospitalRestApi/log4net.config +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Hospital/HospitalWebApp/APIClient.cs b/Hospital/HospitalWebApp/APIClient.cs index 8883e9d..ad54951 100644 --- a/Hospital/HospitalWebApp/APIClient.cs +++ b/Hospital/HospitalWebApp/APIClient.cs @@ -1,7 +1,4 @@ using HospitalContracts.ViewModels; -using Newtonsoft.Json; -using System.Net.Http.Headers; -using System.Text; namespace HospitalWebApp { @@ -10,68 +7,9 @@ namespace HospitalWebApp /// public static class APIClient { - /// - /// Http-клиент - /// - private static readonly HttpClient _client = new(); - /// /// Авторизованный доктор /// public static DoctorViewModel? Doctor { get; set; } = null; - - /// - /// Подключение - /// - /// - public static void Connect(IConfiguration configuration) - { - _client.BaseAddress = new Uri(configuration["IPAddress"]); - _client.DefaultRequestHeaders.Accept.Clear(); - _client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); - } - - /// - /// Get-запрос - /// - /// - /// - /// - /// - public static T? GetRequest(string requestUrl) - { - var response = _client.GetAsync(requestUrl); - - var result = response.Result.Content.ReadAsStringAsync().Result; - if (response.Result.IsSuccessStatusCode) - { - return JsonConvert.DeserializeObject(result); - } - else - { - throw new Exception(result); - } - } - - /// - /// Post-запрос - /// - /// - /// - /// - /// - public static void PostRequest(string requestUrl, T model) - { - var json = JsonConvert.SerializeObject(model); - var data = new StringContent(json, Encoding.UTF8, "application/json"); - - var response = _client.PostAsync(requestUrl, data); - - var result = response.Result.Content.ReadAsStringAsync().Result; - if (!response.Result.IsSuccessStatusCode) - { - throw new Exception(result); - } - } } } diff --git a/Hospital/HospitalWebApp/Controllers/DiseaseController.cs b/Hospital/HospitalWebApp/Controllers/DiseaseController.cs index 0b81392..40d8ea2 100644 --- a/Hospital/HospitalWebApp/Controllers/DiseaseController.cs +++ b/Hospital/HospitalWebApp/Controllers/DiseaseController.cs @@ -1,4 +1,6 @@ using HospitalContracts.BindingModels; +using HospitalContracts.BusinessLogicsContracts; +using HospitalContracts.SearchModels; using HospitalContracts.ViewModels; using HospitalDataModels.Models; using Microsoft.AspNetCore.Mvc; @@ -15,13 +17,27 @@ namespace HospitalWebApp.Controllers /// private readonly ILogger _logger; - /// - /// Конструктор - /// - /// - public DiseaseController(ILogger logger) + /// + /// Бизнес-логика для сущности "Болезнь" + /// + private readonly IDiseaseLogic _diseaseLogic; + + /// + /// Бизнес-логика для сущности "Рецепт" + /// + private readonly IRecipeLogic _recipeLogic; + + /// + /// Конструктор + /// + /// + /// + /// + public DiseaseController(ILogger logger, IDiseaseLogic diseaseLogic, IRecipeLogic recipeLogic) { _logger = logger; + _diseaseLogic = diseaseLogic; + _recipeLogic = recipeLogic; } /// @@ -36,7 +52,7 @@ namespace HospitalWebApp.Controllers return Redirect("~/Home/Enter"); } - return View(APIClient.GetRequest>($"api/disease/getdiseases")); + return View(_diseaseLogic.ReadList(null)); } /// @@ -51,7 +67,11 @@ namespace HospitalWebApp.Controllers return Redirect("~/Home/Enter"); } - ViewBag.Recipes = APIClient.GetRequest>($"api/recipe/getrecipes?doctorId={APIClient.Doctor.Id}"); + ViewBag.Recipes = _recipeLogic.ReadList(new RecipeSearchModel + { + DoctorId = APIClient.Doctor.Id, + }); + return View(); } @@ -63,27 +83,27 @@ namespace HospitalWebApp.Controllers /// /// [HttpPost] - public void CreateDisease(string name, string? symptoms, int recipeId) + public void CreateDisease(string name, string? symptoms, int recipe) { if (APIClient.Doctor == null) { throw new Exception("Необходимо авторизоваться!"); } - if (string.IsNullOrEmpty(name) || recipeId <= 0) + if (string.IsNullOrEmpty(name) || recipe <= 0) { throw new Exception("Введены не все данные!"); } - APIClient.PostRequest("api/disease/createdisease", new DiseaseBindingModel + _diseaseLogic.Create(new DiseaseBindingModel { Name = name, Symptoms = symptoms, - RecipeId = recipeId + RecipeId = recipe }); - Response.Redirect("Diseases"); - } + Response.Redirect("/Disease/Diseases"); + } /// /// Редактировать болезнь @@ -97,8 +117,15 @@ namespace HospitalWebApp.Controllers return Redirect("~/Home/Enter"); } - ViewBag.Recipes = APIClient.GetRequest>($"api/recipe/getrecipes?doctorId={APIClient.Doctor.Id}"); - return View(APIClient.GetRequest($"api/disease/getdisease?id={id}")); + ViewBag.Recipes = _recipeLogic.ReadList(new RecipeSearchModel + { + DoctorId = APIClient.Doctor.Id, + }); + + return View(_diseaseLogic.ReadElement(new DiseaseSearchModel + { + Id = id + })); } /// @@ -110,28 +137,28 @@ namespace HospitalWebApp.Controllers /// /// [HttpPost] - public void UpdateDisease(int id, string name, string? symptoms, int recipeId) + public void UpdateDisease(int id, string name, string? symptoms, int recipe) { if (APIClient.Doctor == null) { throw new Exception("Необходимо авторизоваться!"); } - if (string.IsNullOrEmpty(name) || recipeId <= 0) + if (string.IsNullOrEmpty(name) || recipe <= 0) { throw new Exception("Введены не все данные!"); } - APIClient.PostRequest("api/disease/updatedisease", new DiseaseBindingModel + _diseaseLogic.Update(new DiseaseBindingModel { Id = id, Name = name, Symptoms = symptoms, - RecipeId = recipeId + RecipeId = recipe }); - Response.Redirect("Diseases"); - } + Response.Redirect("/Disease/Diseases"); + } /// /// Удалить болезнь @@ -145,12 +172,12 @@ namespace HospitalWebApp.Controllers throw new Exception("Необходимо авторизоваться!"); } - APIClient.PostRequest($"api/disease/deletedisease", new DiseaseBindingModel + _diseaseLogic.Delete(new DiseaseBindingModel { Id = id }); - Response.Redirect("Diseases"); - } + Response.Redirect("/Disease/Diseases"); + } } } diff --git a/Hospital/HospitalWebApp/Controllers/HomeController.cs b/Hospital/HospitalWebApp/Controllers/HomeController.cs index 2d1cb3e..5bd1c30 100644 --- a/Hospital/HospitalWebApp/Controllers/HomeController.cs +++ b/Hospital/HospitalWebApp/Controllers/HomeController.cs @@ -1,4 +1,6 @@ using HospitalContracts.BindingModels; +using HospitalContracts.BusinessLogicsContracts; +using HospitalContracts.SearchModels; using HospitalContracts.ViewModels; using HospitalDataModels.Enums; using HospitalWebApp.Models; @@ -17,13 +19,20 @@ namespace HospitalWebApp.Controllers /// private readonly ILogger _logger; + /// + /// Бизнес-логика для сущности "Доктор" + /// + private readonly IDoctorLogic _doctorLogic; + /// /// Конструктор /// /// - public HomeController(ILogger logger) + /// + public HomeController(ILogger logger, IDoctorLogic doctorLogic) { _logger = logger; + _doctorLogic = doctorLogic; } /// @@ -31,7 +40,7 @@ namespace HospitalWebApp.Controllers /// /// [HttpGet] - public IActionResult MainPage() + public IActionResult Index() { if (APIClient.Doctor == null) { @@ -77,7 +86,7 @@ namespace HospitalWebApp.Controllers throw new Exception("Введены не все данные!"); } - APIClient.PostRequest("api/doctor/update", new DoctorBindingModel + _doctorLogic.Update(new DoctorBindingModel { Id = APIClient.Doctor.Id, FullName = fullname, @@ -101,6 +110,11 @@ namespace HospitalWebApp.Controllers [HttpGet] public IActionResult Enter() { + if (APIClient.Doctor != null) + { + throw new Exception("Вы уже авторизовались!"); + } + return View(); } @@ -118,13 +132,17 @@ namespace HospitalWebApp.Controllers throw new Exception("Введены не все данные!"); } - APIClient.Doctor = APIClient.GetRequest($"api/doctor/login?email={email}&password={password}"); + APIClient.Doctor = _doctorLogic.ReadElement(new DoctorSearchModel + { + Email = email, + Password = password + }); if (APIClient.Doctor == null) { throw new Exception("Неверный логин/пароль"); } - Response.Redirect("MainPage"); + Response.Redirect("Index"); } /// @@ -134,6 +152,11 @@ namespace HospitalWebApp.Controllers [HttpGet] public IActionResult Register() { + if (APIClient.Doctor != null) + { + throw new Exception("Вы уже зарегистрировались!"); + } + return View(); } @@ -153,7 +176,7 @@ namespace HospitalWebApp.Controllers throw new Exception("Введены не все данные!"); } - APIClient.PostRequest("api/doctor/register", new DoctorBindingModel + _doctorLogic.Create(new DoctorBindingModel { FullName = fullname, Post = post, @@ -164,6 +187,22 @@ namespace HospitalWebApp.Controllers Response.Redirect("Enter"); } + /// + /// Выйти из аккаунта + /// + /// + [HttpGet] + public void Logout() + { + if (APIClient.Doctor == null) + { + throw new Exception("Необходимо авторизоваться!"); + } + + APIClient.Doctor = null; + Response.Redirect("Enter"); + } + /// /// Ошибка /// diff --git a/Hospital/HospitalWebApp/Controllers/MedicineController.cs b/Hospital/HospitalWebApp/Controllers/MedicineController.cs index 19e83a3..451f19d 100644 --- a/Hospital/HospitalWebApp/Controllers/MedicineController.cs +++ b/Hospital/HospitalWebApp/Controllers/MedicineController.cs @@ -1,6 +1,7 @@ using HospitalContracts.BindingModels; +using HospitalContracts.BusinessLogicsContracts; +using HospitalContracts.SearchModels; using HospitalContracts.ViewModels; -using HospitalDataModels.Models; using Microsoft.AspNetCore.Mvc; namespace HospitalWebApp.Controllers @@ -16,12 +17,19 @@ namespace HospitalWebApp.Controllers private readonly ILogger _logger; /// - /// Конструктор + /// Бизнес-логика для сущности "Лекарство" /// - /// - public MedicineController(ILogger logger) + private readonly IMedicineLogic _medicineLogic; + + /// + /// Конструктор + /// + /// + /// + public MedicineController(ILogger logger, IMedicineLogic medicineLogic) { _logger = logger; + _medicineLogic = medicineLogic; } /// @@ -36,7 +44,7 @@ namespace HospitalWebApp.Controllers return Redirect("~/Home/Enter"); } - return View(APIClient.GetRequest>($"api/medicine/getmedicines")); + return View(_medicineLogic.ReadList(null)); } /// @@ -73,14 +81,14 @@ namespace HospitalWebApp.Controllers throw new Exception("Введены не все данные!"); } - APIClient.PostRequest("api/medicine/createmedicine", new MedicineBindingModel + _medicineLogic.Create(new MedicineBindingModel { Name = name, Description = description }); - Response.Redirect("Medicines"); - } + Response.Redirect("/Medicine/Medicines"); + } /// /// Редактировать лекарство @@ -94,7 +102,10 @@ namespace HospitalWebApp.Controllers return Redirect("~/Home/Enter"); } - return View(APIClient.GetRequest($"api/medicine/getmedicine?id={id}")); + return View(_medicineLogic.ReadElement(new MedicineSearchModel + { + Id = id + })); } /// @@ -116,14 +127,14 @@ namespace HospitalWebApp.Controllers throw new Exception("Введены не все данные!"); } - APIClient.PostRequest("api/medicine/updatemedicine", new MedicineBindingModel + _medicineLogic.Update(new MedicineBindingModel { Id = id, Name = name, Description = description }); - Response.Redirect("Medicines"); + Response.Redirect("/Medicine/Medicines"); } /// @@ -138,12 +149,12 @@ namespace HospitalWebApp.Controllers throw new Exception("Необходимо авторизоваться!"); } - APIClient.PostRequest($"api/medicine/deletemedicine", new MedicineBindingModel + _medicineLogic.Delete(new MedicineBindingModel { Id = id }); - Response.Redirect("Medicines"); - } + Response.Redirect("/Medicine/Medicines"); + } } } diff --git a/Hospital/HospitalWebApp/Controllers/PatientController.cs b/Hospital/HospitalWebApp/Controllers/PatientController.cs index cf8a338..30bd30c 100644 --- a/Hospital/HospitalWebApp/Controllers/PatientController.cs +++ b/Hospital/HospitalWebApp/Controllers/PatientController.cs @@ -1,5 +1,7 @@ -using HospitalContracts.BindingModels; +using DocumentFormat.OpenXml.Office2010.Excel; +using HospitalContracts.BindingModels; using HospitalContracts.BusinessLogicsContracts; +using HospitalContracts.SearchModels; using HospitalContracts.ViewModels; using HospitalDataModels.Models; using Microsoft.AspNetCore.Mvc; @@ -17,13 +19,34 @@ namespace HospitalWebApp.Controllers /// private readonly ILogger _logger; + /// + /// Бизнес-логика для сущности "Пациент" + /// + private readonly IPatientLogic _patientLogic; + + /// + /// Бизнес-логика для сущности "Рецепт" + /// + private readonly IRecipeLogic _recipeLogic; + + /// + /// Бизнес-логика для сущности "Процедура" + /// + private readonly IProcedureLogic _procedureLogic; + /// /// Конструктор /// /// - public PatientController(ILogger logger) + /// + /// + /// + public PatientController(ILogger logger, IPatientLogic patientLogic, IRecipeLogic recipeLogic, IProcedureLogic procedureLogic) { _logger = logger; + _patientLogic = patientLogic; + _recipeLogic = recipeLogic; + _procedureLogic = procedureLogic; } /// @@ -38,7 +61,10 @@ namespace HospitalWebApp.Controllers return Redirect("~/Home/Enter"); } - return View(APIClient.GetRequest>($"api/patient/getpatients?doctorId={APIClient.Doctor.Id}")); + return View(_patientLogic.ReadList(new PatientSearchModel + { + DoctorId = APIClient.Doctor.Id, + })); } /// @@ -53,7 +79,8 @@ namespace HospitalWebApp.Controllers return Redirect("~/Home/Enter"); } - ViewBag.Procedures = APIClient.GetRequest>("api/procedure/getprocedures"); + ViewBag.Procedures = _procedureLogic.ReadList(null); + return View(); } @@ -81,10 +108,10 @@ namespace HospitalWebApp.Controllers Dictionary patientProcedures = new Dictionary(); foreach (var procedureId in procedures) { - patientProcedures.Add(procedureId, APIClient.GetRequest($"api/procedure/getprocedure?id={procedureId}")); + patientProcedures.Add(procedureId, _procedureLogic.ReadElement(new ProcedureSearchModel { Id = procedureId })!); } - APIClient.PostRequest("api/patient/createpatient", new PatientBindingModel + _patientLogic.Create(new PatientBindingModel { FullName = fullname, BirthDate = birthdate, @@ -93,7 +120,7 @@ namespace HospitalWebApp.Controllers PatientProcedures = patientProcedures }); - Response.Redirect("Patients"); + Response.Redirect("/Patient/Patients"); } /// @@ -108,8 +135,12 @@ namespace HospitalWebApp.Controllers return Redirect("~/Home/Enter"); } - ViewBag.Procedures = APIClient.GetRequest>("api/procedure/getprocedures"); - return View(APIClient.GetRequest($"api/patient/getpatient?id={id}")); + ViewBag.Procedures = _procedureLogic.ReadList(null); + + return View(_patientLogic.ReadElement(new PatientSearchModel + { + Id = id + })); } /// @@ -136,20 +167,22 @@ namespace HospitalWebApp.Controllers Dictionary patientProcedures = new Dictionary(); foreach (var procedureId in procedures) { - patientProcedures.Add(procedureId, APIClient.GetRequest($"api/procedure/getprocedure?id={procedureId}")); + patientProcedures.Add(procedureId, _procedureLogic.ReadElement(new ProcedureSearchModel { Id = procedureId })!); } - APIClient.PostRequest("api/patient/updatepatient", new PatientBindingModel + var patient = _patientLogic.ReadElement(new PatientSearchModel { Id = id }); + _patientLogic.Update(new PatientBindingModel { Id = id, FullName = fullname, BirthDate = birthdate, Phone = phone, DoctorId = APIClient.Doctor.Id, + PatientRecipes = patient!.PatientRecipes, PatientProcedures = patientProcedures }); - Response.Redirect("Patients"); + Response.Redirect("/Patient/Patients"); } /// @@ -164,12 +197,12 @@ namespace HospitalWebApp.Controllers throw new Exception("Необходимо авторизоваться!"); } - APIClient.PostRequest($"api/patient/deletepatient", new PatientBindingModel + _patientLogic.Delete(new PatientBindingModel { Id = id }); - Response.Redirect("Patients"); + Response.Redirect("/Patient/Patients"); } /// @@ -185,8 +218,15 @@ namespace HospitalWebApp.Controllers throw new Exception("Необходимо авторизоваться!"); } - ViewBag.Patients = APIClient.GetRequest>($"api/patient/getpatients?doctorId={APIClient.Doctor.Id}"); - ViewBag.Recipes = APIClient.GetRequest>($"api/recipe/getrecipes?doctorId={APIClient.Doctor.Id}"); + ViewBag.Patients = _patientLogic.ReadList(new PatientSearchModel + { + DoctorId = APIClient.Doctor.Id + }); + ViewBag.Recipes = _recipeLogic.ReadList(new RecipeSearchModel + { + DoctorId = APIClient.Doctor.Id + }); + return View(); } @@ -212,11 +252,11 @@ namespace HospitalWebApp.Controllers Dictionary patientRecipes = new Dictionary(); foreach (var recipeId in recipes) { - patientRecipes.Add(recipeId, APIClient.GetRequest($"api/recipe/getrecipe?id={recipeId}")); + patientRecipes.Add(recipeId, _recipeLogic.ReadElement(new RecipeSearchModel { Id = recipeId })!); } - var patient = APIClient.GetRequest($"api/patient/getpatient?id={patientId}"); - APIClient.PostRequest("api/patient/updatepatient", new PatientBindingModel + var patient = _patientLogic.ReadElement(new PatientSearchModel { Id = patientId }); + _patientLogic.Update(new PatientBindingModel { Id = patient!.Id, FullName = patient!.FullName, @@ -227,7 +267,38 @@ namespace HospitalWebApp.Controllers PatientRecipes = patientRecipes }); - Response.Redirect("Patients"); + Response.Redirect("/Patient/Patients"); + } + + /// + /// Получить список рецептов пациента + /// + /// + /// + /// + [HttpGet] + public JsonResult GetPatientRecipes(int patientId) + { + if (APIClient.Doctor == null) + { + throw new Exception("Необходимо авторизоваться!"); + } + + var allRecipes = _recipeLogic.ReadList(new RecipeSearchModel + { + DoctorId = APIClient.Doctor.Id + }); + + var patient = _patientLogic.ReadElement(new PatientSearchModel { Id = patientId }); + var patientRecipeIds = patient?.PatientRecipes?.Select(x => x.Key).ToList() ?? new List(); + + var result = new + { + allRecipes = allRecipes.Select(r => new { id = r.Id, issueDate = r.IssueDate }), + patientRecipeIds = patientRecipeIds + }; + + return Json(result); } } } diff --git a/Hospital/HospitalWebApp/Controllers/ProcedureController.cs b/Hospital/HospitalWebApp/Controllers/ProcedureController.cs index f1061ee..737a8fe 100644 --- a/Hospital/HospitalWebApp/Controllers/ProcedureController.cs +++ b/Hospital/HospitalWebApp/Controllers/ProcedureController.cs @@ -1,4 +1,6 @@ using HospitalContracts.BindingModels; +using HospitalContracts.BusinessLogicsContracts; +using HospitalContracts.SearchModels; using HospitalContracts.ViewModels; using HospitalDataModels.Models; using Microsoft.AspNetCore.Mvc; @@ -15,13 +17,27 @@ namespace HospitalWebApp.Controllers /// private readonly ILogger _logger; - /// - /// Конструктор - /// - /// - public ProcedureController(ILogger logger) + /// + /// Бизнес-логика для сущности "Процедура" + /// + private readonly IProcedureLogic _procedureLogic; + + /// + /// Бизнес-логика для сущности "Лекарство" + /// + private readonly IMedicineLogic _medicineLogic; + + /// + /// Конструктор + /// + /// + /// + /// + public ProcedureController(ILogger logger, IProcedureLogic procedureLogic, IMedicineLogic medicineLogic) { _logger = logger; + _procedureLogic = procedureLogic; + _medicineLogic = medicineLogic; } /// @@ -36,7 +52,7 @@ namespace HospitalWebApp.Controllers return Redirect("~/Home/Enter"); } - return View(APIClient.GetRequest>($"api/procedure/getprocedures")); + return View(_procedureLogic.ReadList(null)); } /// @@ -51,7 +67,7 @@ namespace HospitalWebApp.Controllers return Redirect("~/Home/Enter"); } - ViewBag.Medicines = APIClient.GetRequest>("api/medicine/getmedicines"); + ViewBag.Medicines = _medicineLogic.ReadList(null); return View(); } @@ -78,17 +94,17 @@ namespace HospitalWebApp.Controllers Dictionary procedureMedicines = new Dictionary(); foreach (var medicineId in medicines) { - procedureMedicines.Add(medicineId, APIClient.GetRequest($"api/medicine/getmedicine?id={medicineId}")); + procedureMedicines.Add(medicineId, _medicineLogic.ReadElement(new MedicineSearchModel { Id = medicineId })!); } - APIClient.PostRequest("api/procedure/createprocedure", new ProcedureBindingModel + _procedureLogic.Create(new ProcedureBindingModel { Name = name, Description = description, ProcedureMedicines = procedureMedicines }); - Response.Redirect("Procedures"); + Response.Redirect("/Procedure/Procedures"); } /// @@ -103,8 +119,12 @@ namespace HospitalWebApp.Controllers return Redirect("~/Home/Enter"); } - ViewBag.Medicines = APIClient.GetRequest>("api/medicine/getmedicines"); - return View(APIClient.GetRequest($"api/procedure/getprocedure?id={id}")); + ViewBag.Medicines = _medicineLogic.ReadList(null); + + return View(_procedureLogic.ReadElement(new ProcedureSearchModel + { + Id = id + })); } /// @@ -127,22 +147,22 @@ namespace HospitalWebApp.Controllers throw new Exception("Введены не все данные!"); } - Dictionary procedureMedicines = new Dictionary(); - foreach (var medicineId in medicines) - { - procedureMedicines.Add(medicineId, APIClient.GetRequest($"api/medicine/getmedicine?id={medicineId}")); - } + Dictionary procedureMedicines = new Dictionary(); + foreach (var medicineId in medicines) + { + procedureMedicines.Add(medicineId, _medicineLogic.ReadElement(new MedicineSearchModel { Id = medicineId })!); + } - APIClient.PostRequest("api/procedure/updateprocedure", new ProcedureBindingModel - { + _procedureLogic.Update(new ProcedureBindingModel + { Id = id, - Name = name, - Description = description, - ProcedureMedicines = procedureMedicines - }); + Name = name, + Description = description, + ProcedureMedicines = procedureMedicines + }); - Response.Redirect("Procedures"); - } + Response.Redirect("/Procedure/Procedures"); + } /// /// Удалить процедуру @@ -156,12 +176,12 @@ namespace HospitalWebApp.Controllers throw new Exception("Необходимо авторизоваться!"); } - APIClient.PostRequest($"api/procedure/deleteprocedure", new ProcedureBindingModel + _procedureLogic.Delete(new ProcedureBindingModel { Id = id }); - Response.Redirect("Prodecures"); - } + Response.Redirect("/Procedure/Procedures"); + } } } diff --git a/Hospital/HospitalWebApp/Controllers/RecipeController.cs b/Hospital/HospitalWebApp/Controllers/RecipeController.cs index 15dd15a..05cfd45 100644 --- a/Hospital/HospitalWebApp/Controllers/RecipeController.cs +++ b/Hospital/HospitalWebApp/Controllers/RecipeController.cs @@ -1,4 +1,6 @@ using HospitalContracts.BindingModels; +using HospitalContracts.BusinessLogicsContracts; +using HospitalContracts.SearchModels; using HospitalContracts.ViewModels; using HospitalDataModels.Models; using Microsoft.AspNetCore.Mvc; @@ -16,13 +18,28 @@ namespace HospitalWebApp.Controllers /// private readonly ILogger _logger; + + /// + /// Бизнес-логика для сущности "Рецепт" + /// + private readonly IRecipeLogic _recipeLogic; + + /// + /// Бизнес-логика для сущности "Лекарство" + /// + private readonly IMedicineLogic _medicineLogic; + /// /// Конструктор /// /// - public RecipeController(ILogger logger) + /// + /// + public RecipeController(ILogger logger, IRecipeLogic recipeLogic, IMedicineLogic medicineLogic) { _logger = logger; + _recipeLogic = recipeLogic; + _medicineLogic = medicineLogic; } /// @@ -37,7 +54,10 @@ namespace HospitalWebApp.Controllers return Redirect("~/Home/Enter"); } - return View(APIClient.GetRequest>($"api/recipe/getrecipes?doctorId={APIClient.Doctor.Id}")); + return View(_recipeLogic.ReadList(new RecipeSearchModel + { + DoctorId = APIClient.Doctor.Id, + })); } /// @@ -52,7 +72,7 @@ namespace HospitalWebApp.Controllers return Redirect("~/Home/Enter"); } - ViewBag.Medicines = APIClient.GetRequest>("api/medicine/getmedicines"); + ViewBag.Medicines = _medicineLogic.ReadList(null); return View(); } @@ -78,17 +98,17 @@ namespace HospitalWebApp.Controllers Dictionary recipeMedicines = new Dictionary(); foreach (var medicineId in medicines) { - recipeMedicines.Add(medicineId, APIClient.GetRequest($"api/medicine/getmedicine?id={medicineId}")); + recipeMedicines.Add(medicineId, _medicineLogic.ReadElement(new MedicineSearchModel { Id = medicineId })!); } - APIClient.PostRequest("api/recipe/createrecipe", new RecipeBindingModel + _recipeLogic.Create(new RecipeBindingModel { IssueDate = issuedate, DoctorId = APIClient.Doctor.Id, RecipeMedicines = recipeMedicines }); - Response.Redirect("Recipes"); + Response.Redirect("/Recipe/Recipes"); } /// @@ -103,8 +123,12 @@ namespace HospitalWebApp.Controllers return Redirect("~/Home/Enter"); } - ViewBag.Medicines = APIClient.GetRequest>("api/medicine/getmedicines"); - return View(APIClient.GetRequest($"api/patient/getpatient?id={id}")); + ViewBag.Medicines = _medicineLogic.ReadList(null); + + return View(_recipeLogic.ReadElement(new RecipeSearchModel + { + Id = id + })); } /// @@ -130,10 +154,10 @@ namespace HospitalWebApp.Controllers Dictionary recipeMedicines = new Dictionary(); foreach (var medicineId in medicines) { - recipeMedicines.Add(medicineId, APIClient.GetRequest($"api/medicine/getmedicine?id={medicineId}")); + recipeMedicines.Add(medicineId, _medicineLogic.ReadElement(new MedicineSearchModel { Id = medicineId })!); } - APIClient.PostRequest("api/recipe/updaterecipe", new RecipeBindingModel + _recipeLogic.Update(new RecipeBindingModel { Id = id, IssueDate = issuedate, @@ -141,7 +165,7 @@ namespace HospitalWebApp.Controllers RecipeMedicines = recipeMedicines }); - Response.Redirect("Recipes"); + Response.Redirect("/Recipe/Recipes"); } /// @@ -156,12 +180,12 @@ namespace HospitalWebApp.Controllers throw new Exception("Необходимо авторизоваться!"); } - APIClient.PostRequest($"api/recipe/deleterecipe", new RecipeBindingModel + _recipeLogic.Delete(new RecipeBindingModel { Id = id }); - Response.Redirect("Recipes"); + Response.Redirect("/Recipe/Recipes"); } } } diff --git a/Hospital/HospitalWebApp/HospitalWebApp.csproj b/Hospital/HospitalWebApp/HospitalWebApp.csproj index ef16dd3..4567e9c 100644 --- a/Hospital/HospitalWebApp/HospitalWebApp.csproj +++ b/Hospital/HospitalWebApp/HospitalWebApp.csproj @@ -11,7 +11,9 @@ + + diff --git a/Hospital/HospitalWebApp/Program.cs b/Hospital/HospitalWebApp/Program.cs index 3ea86a8..469f5dd 100644 --- a/Hospital/HospitalWebApp/Program.cs +++ b/Hospital/HospitalWebApp/Program.cs @@ -1,3 +1,9 @@ +using HospitalBusinessLogics.BusinessLogics; +using HospitalBusinessLogics.OfficePackage; +using HospitalBusinessLogics.OfficePackage.Implements; +using HospitalContracts.BusinessLogicsContracts; +using HospitalContracts.StoragesContracts; +using HospitalDatabaseImplement.Implements; using HospitalWebApp; var builder = WebApplication.CreateBuilder(args); @@ -5,9 +11,29 @@ var builder = WebApplication.CreateBuilder(args); // Add services to the container. builder.Services.AddControllersWithViews(); -var app = builder.Build(); +// Storage services +builder.Services.AddTransient(); +builder.Services.AddTransient(); +builder.Services.AddTransient(); +builder.Services.AddTransient(); +builder.Services.AddTransient(); +builder.Services.AddTransient(); -APIClient.Connect(builder.Configuration); +// BusinessLogic services +builder.Services.AddTransient(); +builder.Services.AddTransient(); +builder.Services.AddTransient(); +builder.Services.AddTransient(); +builder.Services.AddTransient(); +builder.Services.AddTransient(); + +// BusinessLogic Reports services +builder.Services.AddTransient(); +builder.Services.AddTransient(); +builder.Services.AddTransient(); +builder.Services.AddTransient(); + +var app = builder.Build(); // Configure the HTTP request pipeline. if (!app.Environment.IsDevelopment()) diff --git a/Hospital/HospitalWebApp/Views/Disease/Diseases.cshtml b/Hospital/HospitalWebApp/Views/Disease/Diseases.cshtml index 91eb381..e5fee02 100644 --- a/Hospital/HospitalWebApp/Views/Disease/Diseases.cshtml +++ b/Hospital/HospitalWebApp/Views/Disease/Diseases.cshtml @@ -29,6 +29,8 @@ Название Симптомы Номер рецепта + Изменить + Удалить diff --git a/Hospital/HospitalWebApp/Views/Home/MainPage.cshtml b/Hospital/HospitalWebApp/Views/Home/Index.cshtml similarity index 100% rename from Hospital/HospitalWebApp/Views/Home/MainPage.cshtml rename to Hospital/HospitalWebApp/Views/Home/Index.cshtml diff --git a/Hospital/HospitalWebApp/Views/Home/Privacy.cshtml b/Hospital/HospitalWebApp/Views/Home/Privacy.cshtml index 6c2a35d..f5ac94d 100644 --- a/Hospital/HospitalWebApp/Views/Home/Privacy.cshtml +++ b/Hospital/HospitalWebApp/Views/Home/Privacy.cshtml @@ -23,11 +23,11 @@
Должность:
diff --git a/Hospital/HospitalWebApp/Views/Medicine/Medicines.cshtml b/Hospital/HospitalWebApp/Views/Medicine/Medicines.cshtml index 44111b4..66c0195 100644 --- a/Hospital/HospitalWebApp/Views/Medicine/Medicines.cshtml +++ b/Hospital/HospitalWebApp/Views/Medicine/Medicines.cshtml @@ -28,6 +28,8 @@ Номер Название Описание + Изменить + Удалить diff --git a/Hospital/HospitalWebApp/Views/Patient/CreatePatientRecipe.cshtml b/Hospital/HospitalWebApp/Views/Patient/CreatePatientRecipe.cshtml index 20647d2..796ab9a 100644 --- a/Hospital/HospitalWebApp/Views/Patient/CreatePatientRecipe.cshtml +++ b/Hospital/HospitalWebApp/Views/Patient/CreatePatientRecipe.cshtml @@ -11,7 +11,7 @@
Пациенты:
- @foreach (var patient in ViewBag.Patients) { @@ -38,4 +38,28 @@
- \ No newline at end of file + + + + \ No newline at end of file diff --git a/Hospital/HospitalWebApp/Views/Patient/Patients.cshtml b/Hospital/HospitalWebApp/Views/Patient/Patients.cshtml index 5105474..e93e145 100644 --- a/Hospital/HospitalWebApp/Views/Patient/Patients.cshtml +++ b/Hospital/HospitalWebApp/Views/Patient/Patients.cshtml @@ -30,6 +30,8 @@ Дата рождения Номер телефона Лечащий врач + Изменить + Удалить @@ -39,7 +41,7 @@ @Html.DisplayFor(modelItem => patient.Id) @Html.DisplayFor(modelItem => patient.FullName) - @Html.DisplayFor(modelItem => patient.BirthDate.ToShortDateString()) + @Html.DisplayFor(modelItem => patient.BirthDate) @Html.DisplayFor(modelItem => patient.Phone) @Html.DisplayFor(modelItem => patient.DoctorFullName) diff --git a/Hospital/HospitalWebApp/Views/Patient/UpdatePatient.cshtml b/Hospital/HospitalWebApp/Views/Patient/UpdatePatient.cshtml index 97d6978..2c869db 100644 --- a/Hospital/HospitalWebApp/Views/Patient/UpdatePatient.cshtml +++ b/Hospital/HospitalWebApp/Views/Patient/UpdatePatient.cshtml @@ -20,7 +20,7 @@
Дата рождения:
-
+
diff --git a/Hospital/HospitalWebApp/Views/Procedure/Procedures.cshtml b/Hospital/HospitalWebApp/Views/Procedure/Procedures.cshtml index 9892a64..2926574 100644 --- a/Hospital/HospitalWebApp/Views/Procedure/Procedures.cshtml +++ b/Hospital/HospitalWebApp/Views/Procedure/Procedures.cshtml @@ -28,6 +28,8 @@ Номер Название Описание + Изменить + Удалить diff --git a/Hospital/HospitalWebApp/Views/Recipe/Recipes.cshtml b/Hospital/HospitalWebApp/Views/Recipe/Recipes.cshtml index 7858b56..1fd719e 100644 --- a/Hospital/HospitalWebApp/Views/Recipe/Recipes.cshtml +++ b/Hospital/HospitalWebApp/Views/Recipe/Recipes.cshtml @@ -28,6 +28,8 @@ Номер Дата выписки Доктор + Изменить + Удалить @@ -36,7 +38,7 @@ { @Html.DisplayFor(modelItem => recipe.Id) - @Html.DisplayFor(modelItem => recipe.IssueDate.ToShortDateString()) + @Html.DisplayFor(modelItem => recipe.IssueDate) @Html.DisplayFor(modelItem => recipe.DoctorFullName)

@@ -53,7 +55,7 @@ @section scripts {