diff --git a/Hospital/HospitalDatabaseImplement/LoaderFromXML.cs b/Hospital/HospitalDatabaseImplement/LoaderFromXML.cs index 5a8ca82..7316dce 100644 --- a/Hospital/HospitalDatabaseImplement/LoaderFromXML.cs +++ b/Hospital/HospitalDatabaseImplement/LoaderFromXML.cs @@ -4,10 +4,10 @@ using System.Xml.Linq; namespace HospitalDatabaseImplement { public class LoaderFromXML - { - private static readonly string PatientFileName = "XMLData\\Patient.xml"; - private static readonly string TreatmentFileName = "XMLData\\Treatment.xml"; - private static readonly string ProcedureFileName = "XMLData\\Procedure.xml"; + { + private static readonly string PatientFileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "XMLData\\Patient.xml"); + private static readonly string TreatmentFileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "XMLData\\Treatment.xml"); + private static readonly string ProcedureFileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "XMLData\\Procedure.xml"); private static List? LoadData(string filename, string xmlNodeName, Func selectFunction) { diff --git a/Hospital/HospitalRestApi/Program.cs b/Hospital/HospitalRestApi/Program.cs index d01dde9..c25b7e2 100644 --- a/Hospital/HospitalRestApi/Program.cs +++ b/Hospital/HospitalRestApi/Program.cs @@ -5,6 +5,7 @@ using HospitalBusinessLogic.OfficePackage.Implements; using HospitalContracts.BindingModels; using HospitalContracts.BusinessLogicContracts; using HospitalContracts.StorageContracts; +using HospitalDatabaseImplement; using HospitalDatabaseImplement.Implements; using Microsoft.OpenApi.Models; @@ -64,7 +65,10 @@ mailSender?.MailConfig(new MailConfigBindingModel SmtpClientHost = builder.Configuration?.GetSection("SmtpClientHost")?.Value?.ToString() ?? string.Empty, SmtpClientPort = Convert.ToInt32(builder.Configuration?.GetSection("SmtpClientPort")?.Value?.ToString()), }); - +// загрузка данных "напарника" +LoaderFromXML.LoadProcedures(); +LoaderFromXML.LoadTreatments(); +LoaderFromXML.LoadPatients(); // Configure the HTTP request pipeline. if (app.Environment.IsDevelopment()) { diff --git a/Hospital/HospitalWeb/Program.cs b/Hospital/HospitalWeb/Program.cs index 93e7cff..44ee4c6 100644 --- a/Hospital/HospitalWeb/Program.cs +++ b/Hospital/HospitalWeb/Program.cs @@ -27,7 +27,4 @@ app.MapControllerRoute( name: "default", pattern: "{controller=Home}/{action=Index}/{id?}"); -LoaderFromXML.LoadProcedures(); -LoaderFromXML.LoadTreatments(); -LoaderFromXML.LoadPatients(); app.Run();