решение конфликтов
This commit is contained in:
commit
01996f74f1
12
Hospital/Hospital/Properties/launchSettings.json
Normal file
12
Hospital/Hospital/Properties/launchSettings.json
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"profiles": {
|
||||
"HospitalView": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"applicationUrl": "https://localhost:51159;http://localhost:51164"
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
{
|
||||
"profiles": {
|
||||
"HospitalBusinessLogic": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"applicationUrl": "https://localhost:51157;http://localhost:51163"
|
||||
}
|
||||
}
|
||||
}
|
@ -14,7 +14,7 @@ namespace HospitalContracts.BindingModels
|
||||
|
||||
public DateTime Date { get; set; }
|
||||
|
||||
public int DescriptionOfTheProcedureId { get; set; }
|
||||
public int DescriptionProcedureId { get; set; }
|
||||
|
||||
public int PharmacistId { get; set; }
|
||||
|
||||
|
12
Hospital/HospitalContracts/Properties/launchSettings.json
Normal file
12
Hospital/HospitalContracts/Properties/launchSettings.json
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"profiles": {
|
||||
"HospitalContracts": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"applicationUrl": "https://localhost:51160;http://localhost:51162"
|
||||
}
|
||||
}
|
||||
}
|
@ -19,7 +19,7 @@ namespace HospitalContracts.ViewModels
|
||||
//public string PharmacistFIO { get; set; } = string.Empty;
|
||||
public int PharmacistId { get; set; }
|
||||
[DisplayName("Описание процедуры")]
|
||||
public int DescriptionOfTheProcedureId { get; set; }
|
||||
public int DescriptionProcedureId { get; set; }
|
||||
public Dictionary<int, IMedicineModel> ProcedureMedicines { get; set; } = new();
|
||||
|
||||
}
|
||||
|
@ -39,7 +39,8 @@ namespace HospitalDatabaseImplement
|
||||
public virtual DbSet<RecipeMedicine> RecipeMedicines { set; get; }
|
||||
|
||||
public virtual DbSet<ProcedureMedicine> ProcedureMedicines { set; get; }
|
||||
|
||||
//TODO добавить сущности описание процедур и промежутучную сущость у фармацевта
|
||||
public virtual DbSet<Pharmacist> Pharmacists { set; get; }
|
||||
public virtual DbSet<DescriptionProcedure> DescriptionProcedures { set; get; }
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,120 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.StoragesContracts;
|
||||
using HospitalContracts.ViewModels;
|
||||
using HospitalDatabaseImplement.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace HospitalDatabaseImplement.Implements
|
||||
{
|
||||
public class DescriptionProcedureStorage : IDescriptionProcedureStorage
|
||||
{
|
||||
public DescriptionProcedureViewModel? GetElement(DescriptionProcedureSearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.Description) && !model.Id.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new HospitalDatabase();
|
||||
return context.DescriptionProcedures
|
||||
.Include(x => x.Procedures)
|
||||
.Include(x => x.Pharmacist)
|
||||
.FirstOrDefault(x => (!string.IsNullOrEmpty(model.Description) && x.Description == model.Description) || (model.Id.HasValue && x.Id == model.Id))
|
||||
?.GetViewModel;
|
||||
}
|
||||
|
||||
public List<DescriptionProcedureViewModel> GetFilteredList(DescriptionProcedureSearchModel model)
|
||||
{
|
||||
using var context = new HospitalDatabase();
|
||||
if (string.IsNullOrEmpty(model.Description) && !model.Id.HasValue)
|
||||
{
|
||||
return context.DescriptionProcedures
|
||||
.Include(x => x.Procedures)
|
||||
.Include(x => x.Pharmacist)
|
||||
.Where(x => x.Id == model.Id)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
else if (model.PharmacistId.HasValue)
|
||||
{
|
||||
return context.DescriptionProcedures
|
||||
.Include(x => x.Procedures)
|
||||
.Include(x => x.Pharmacist)
|
||||
.Where(x => x.PharmacistId == model.PharmacistId)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
return new();
|
||||
}
|
||||
}
|
||||
|
||||
public List<DescriptionProcedureViewModel> GetFullList()
|
||||
{
|
||||
using var context = new HospitalDatabase();
|
||||
return context.DescriptionProcedures
|
||||
.Include(x => x.Procedures)
|
||||
.Include(x => x.Pharmacist)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public DescriptionProcedureViewModel? Insert(DescriptionProcedureBindingModel model)
|
||||
{
|
||||
var newDisease = DescriptionProcedure.Create(model);
|
||||
if (newDisease == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new HospitalDatabase();
|
||||
context.DescriptionProcedures.Add(newDisease);
|
||||
context.SaveChanges();
|
||||
return context.DescriptionProcedures
|
||||
.Include(x => x.Procedures)
|
||||
.Include(x => x.Pharmacist)
|
||||
.FirstOrDefault(x => x.Id == newDisease.Id)
|
||||
?.GetViewModel;
|
||||
}
|
||||
|
||||
public DescriptionProcedureViewModel? Update(DescriptionProcedureBindingModel model)
|
||||
{
|
||||
using var context = new HospitalDatabase();
|
||||
var disease = context.DescriptionProcedures.FirstOrDefault(x => x.Id == model.Id);
|
||||
if (disease == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
disease.Update(model);
|
||||
context.SaveChanges();
|
||||
return context.DescriptionProcedures
|
||||
.Include(x => x.Procedures)
|
||||
.Include(x => x.Pharmacist)
|
||||
.FirstOrDefault(x => x.Id == model.Id)
|
||||
?.GetViewModel;
|
||||
}
|
||||
|
||||
public DescriptionProcedureViewModel? Delete(DescriptionProcedureBindingModel model)
|
||||
{
|
||||
using var context = new HospitalDatabase();
|
||||
var element = context.DescriptionProcedures.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (element != null)
|
||||
{
|
||||
var deletedElement = context.DescriptionProcedures
|
||||
.Include(x => x.Procedures)
|
||||
.Include(x => x.Pharmacist)
|
||||
.FirstOrDefault(x => x.Id == model.Id)
|
||||
?.GetViewModel;
|
||||
context.DescriptionProcedures.Remove(element);
|
||||
context.SaveChanges();
|
||||
return deletedElement;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -9,99 +9,58 @@ using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.StoragesContracts;
|
||||
using HospitalContracts.ViewModels;
|
||||
using HospitalDatabaseImplement.Models;
|
||||
using HospitalDataModels.Models;
|
||||
using HospitalDatabaseImplement.Modelss;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace HospitalDatabaseImplement.Implements
|
||||
{
|
||||
public class MedicineStorage : IMedicineStorage
|
||||
{
|
||||
public MedicineViewModel? GetElement(MedicineSearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.Name) && !model.Id.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new HospitalDatabase();
|
||||
return context.Medicines
|
||||
.Include(x => x.Pharmacist)
|
||||
.Include(x => x.Procedures)
|
||||
.ThenInclude(x => x.Recipe)
|
||||
.FirstOrDefault(x => ((!string.IsNullOrEmpty(model.Name) && x.FIO == model.Name)
|
||||
|| (model.Id.HasValue && x.Id == model.Id)))?.GetViewModel;
|
||||
}
|
||||
|
||||
public List<MedicineViewModel> GetFilteredList(MedicineSearchModel model)
|
||||
{
|
||||
using var context = new HospitalDatabase();
|
||||
if (!string.IsNullOrEmpty(model.Name))
|
||||
{
|
||||
return context.Medicines
|
||||
.Include(x => x.Doctor)
|
||||
.Include(x => x.Recipes)
|
||||
.ThenInclude(x => x.Recipe)
|
||||
.Where(x => (x.Id == model.Id)).ToList()
|
||||
.Select(x => x.GetViewModel).ToList();
|
||||
}
|
||||
else if (model.DoctorId.HasValue)
|
||||
{
|
||||
return context.Medicines
|
||||
.Include(x => x.Doctor)
|
||||
.Include(x => x.Recipes)
|
||||
.ThenInclude(x => x.Recipe)
|
||||
.Where(x => x.DoctorId == model.DoctorId)
|
||||
.Select(x => x.GetViewModel).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
return new();
|
||||
}
|
||||
}
|
||||
|
||||
namespace HospitalDatabaseImplement.Implementss
|
||||
{
|
||||
public class MedicineStorage
|
||||
{
|
||||
|
||||
public List<MedicineViewModel> GetFullList()
|
||||
{
|
||||
using var context = new HospitalDatabase();
|
||||
return context.Medicines
|
||||
.Select(x => x.GetViewModel).ToList();
|
||||
}
|
||||
|
||||
public List<MedicineViewModel> GetFilteredList(MedicineSearchModel model)
|
||||
{
|
||||
using var context = new HospitalDatabase();
|
||||
if (string.IsNullOrEmpty(model.Name) && !model.Id.HasValue)
|
||||
{
|
||||
return context.Medicines
|
||||
.Where(x => x.Name.Contains(model.Name)).ToList()
|
||||
.Select(x => x.GetViewModel).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
return new();
|
||||
}
|
||||
}
|
||||
|
||||
public MedicineViewModel? GetElement(MedicineSearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.Name) && !model.Id.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new HospitalDatabase();
|
||||
return context.Medicines
|
||||
.FirstOrDefault(x => (!string.IsNullOrEmpty(model.Name) && x.Name == model.Name) || (model.Id.HasValue && x.Id == model.Id))?.GetViewModel;
|
||||
}
|
||||
|
||||
public MedicineViewModel? Insert(MedicineBindingModel model)
|
||||
{
|
||||
using var context = new HospitalDatabase();
|
||||
var newMedicine = Medicine.Create(model);
|
||||
if (newMedicine == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
context.Medicines.Add(newMedicine);
|
||||
context.SaveChanges();
|
||||
return newMedicine.GetViewModel;
|
||||
}
|
||||
|
||||
public MedicineViewModel? Update(MedicineBindingModel model)
|
||||
{
|
||||
using var context = new HospitalDatabase();
|
||||
using var transaction = context.Database.BeginTransaction();
|
||||
try
|
||||
{
|
||||
var medicine = context.Medicines
|
||||
.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (medicine == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
medicine.Update(model);
|
||||
context.SaveChanges();
|
||||
transaction.Commit();
|
||||
return medicine.GetViewModel;
|
||||
}
|
||||
catch
|
||||
{
|
||||
transaction.Rollback();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public MedicineViewModel? Delete(MedicineBindingModel model)
|
||||
{
|
||||
using var context = new HospitalDatabase();
|
||||
var element = context.Medicines
|
||||
.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (element != null)
|
||||
{
|
||||
context.Medicines.Remove(element);
|
||||
context.SaveChanges();
|
||||
return element.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,115 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.StoragesContracts;
|
||||
using HospitalContracts.ViewModels;
|
||||
using HospitalDatabaseImplement.Models;
|
||||
using HospitalDatabaseImplement.Modelss;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace HospitalDatabaseImplement.Implements
|
||||
{
|
||||
public class PharmacistStorage : IPharmacistStorage
|
||||
{
|
||||
public PharmacistViewModel? GetElement(PharmacistSearchModel model)
|
||||
{
|
||||
if (!model.Id.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new HospitalDatabase();
|
||||
return context.Pharmacists
|
||||
.Include(x => x.Medicines)
|
||||
.Include(x => x.Procedures)
|
||||
.Include(x => x.DescriptionProcedures)
|
||||
.FirstOrDefault(x => model.Id.HasValue && x.Id == model.Id)
|
||||
?.GetViewModel;
|
||||
}
|
||||
|
||||
public List<PharmacistViewModel> GetFilteredList(PharmacistSearchModel model)
|
||||
{
|
||||
using var context = new HospitalDatabase();
|
||||
if (!string.IsNullOrEmpty(model.Login))
|
||||
{
|
||||
return context.Pharmacists
|
||||
.Include(x => x.Medicines)
|
||||
.Include(x => x.Procedures)
|
||||
.Include(x => x.DescriptionProcedures)
|
||||
.Where(x => x.Login.Contains(model.Login))
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
return new();
|
||||
}
|
||||
|
||||
public List<PharmacistViewModel> GetFullList()
|
||||
{
|
||||
using var context = new HospitalDatabase();
|
||||
return context.Pharmacists
|
||||
.Include(x => x.Medicines)
|
||||
.Include(x => x.Procedures)
|
||||
.Include(x => x.DescriptionProcedures)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public PharmacistViewModel? Insert(PharmacistBindingModel model)
|
||||
{
|
||||
var newDoctor = Pharmacist.Create(model);
|
||||
if (newDoctor == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new HospitalDatabase();
|
||||
context.Pharmacists.Add(newDoctor);
|
||||
context.SaveChanges();
|
||||
return context.Pharmacists
|
||||
.Include(x => x.Medicines)
|
||||
.Include(x => x.Procedures)
|
||||
.Include(x => x.DescriptionProcedures)
|
||||
.FirstOrDefault(x => x.Id == newDoctor.Id)
|
||||
?.GetViewModel;
|
||||
}
|
||||
|
||||
public PharmacistViewModel? Update(PharmacistBindingModel model)
|
||||
{
|
||||
using var context = new HospitalDatabase();
|
||||
var doctor = context.Pharmacists.FirstOrDefault(x => x.Id == model.Id);
|
||||
if (doctor == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
doctor.Update(model);
|
||||
context.SaveChanges();
|
||||
return context.Pharmacists
|
||||
.Include(x => x.Medicines)
|
||||
.Include(x => x.Procedures)
|
||||
.Include(x => x.DescriptionProcedures)
|
||||
.FirstOrDefault(x => x.Id == model.Id)
|
||||
?.GetViewModel;
|
||||
}
|
||||
|
||||
public PharmacistViewModel? Delete(PharmacistBindingModel model)
|
||||
{
|
||||
using var context = new HospitalDatabase();
|
||||
var element = context.Pharmacists.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (element != null)
|
||||
{
|
||||
var deletedElement = context.Pharmacists
|
||||
.Include(x => x.Medicines)
|
||||
.Include(x => x.Procedures)
|
||||
.Include(x => x.DescriptionProcedures)
|
||||
.FirstOrDefault(x => x.Id == model.Id)
|
||||
?.GetViewModel;
|
||||
context.Pharmacists.Remove(element);
|
||||
context.SaveChanges();
|
||||
return deletedElement;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
577
Hospital/HospitalDataBaseImplement/Migrations/20240429112728_Hospital.Designer.cs
generated
Normal file
577
Hospital/HospitalDataBaseImplement/Migrations/20240429112728_Hospital.Designer.cs
generated
Normal file
@ -0,0 +1,577 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using HospitalDatabaseImplement;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace HospitalDatabaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(HospitalDatabase))]
|
||||
[Migration("20240429112728_Hospital")]
|
||||
partial class Hospital
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.17")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.DescriptionProcedure", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasMaxLength(150)
|
||||
.HasColumnType("nvarchar(150)");
|
||||
|
||||
b.Property<int>("PharmacistId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("PharmacistId");
|
||||
|
||||
b.ToTable("DescriptionProcedures");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.Disease", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasMaxLength(150)
|
||||
.HasColumnType("nvarchar(150)");
|
||||
|
||||
b.Property<int>("DoctorId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("DoctorId");
|
||||
|
||||
b.ToTable("Diseases");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.Doctor", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("FIO")
|
||||
.IsRequired()
|
||||
.HasMaxLength(30)
|
||||
.HasColumnType("nvarchar(30)");
|
||||
|
||||
b.Property<string>("Login")
|
||||
.IsRequired()
|
||||
.HasMaxLength(25)
|
||||
.HasColumnType("nvarchar(25)");
|
||||
|
||||
b.Property<string>("MailAddress")
|
||||
.IsRequired()
|
||||
.HasMaxLength(30)
|
||||
.HasColumnType("nvarchar(30)");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasMaxLength(30)
|
||||
.HasColumnType("nvarchar(30)");
|
||||
|
||||
b.Property<string>("PhoneNumber")
|
||||
.IsRequired()
|
||||
.HasMaxLength(11)
|
||||
.HasColumnType("nvarchar(11)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Doctors");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.Medicine", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("CountryOrigin")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)");
|
||||
|
||||
b.Property<int>("PharmacistId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<double>("Price")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("PharmacistId");
|
||||
|
||||
b.ToTable("Medicines");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.Patient", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Address")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)");
|
||||
|
||||
b.Property<DateTime>("BirthDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("DoctorId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("FIO")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("DoctorId");
|
||||
|
||||
b.ToTable("Patients");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.PatientProcedure", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("PatientId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("ProcedureId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("PatientId");
|
||||
|
||||
b.HasIndex("ProcedureId");
|
||||
|
||||
b.ToTable("PatientProcedures");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.PatientRecipe", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("PatientId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("RecipeId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("PatientId");
|
||||
|
||||
b.HasIndex("RecipeId");
|
||||
|
||||
b.ToTable("PatientRecipes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.Pharmacist", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("FIO")
|
||||
.IsRequired()
|
||||
.HasMaxLength(55)
|
||||
.HasColumnType("nvarchar(55)");
|
||||
|
||||
b.Property<string>("Login")
|
||||
.IsRequired()
|
||||
.HasMaxLength(25)
|
||||
.HasColumnType("nvarchar(25)");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasMaxLength(30)
|
||||
.HasColumnType("nvarchar(30)");
|
||||
|
||||
b.Property<string>("PhoneNumber")
|
||||
.IsRequired()
|
||||
.HasMaxLength(11)
|
||||
.HasColumnType("nvarchar(11)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Pharmacists");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.Procedure", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("DescriptionProcedureId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("IDescriptionProcedureId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)");
|
||||
|
||||
b.Property<int>("PharmacistId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("IDescriptionProcedureId");
|
||||
|
||||
b.HasIndex("PharmacistId");
|
||||
|
||||
b.ToTable("Procedures");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.ProcedureMedicine", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("MedicineId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("ProcedureId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("MedicineId");
|
||||
|
||||
b.HasIndex("ProcedureId");
|
||||
|
||||
b.ToTable("ProcedureMedicines");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.RecipeMedicine", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("MedicineId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("RecipeId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("MedicineId");
|
||||
|
||||
b.HasIndex("RecipeId");
|
||||
|
||||
b.ToTable("RecipeMedicines");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Modelss.Recipe", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("DiseaseId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DoctorId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("IssueDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("DiseaseId");
|
||||
|
||||
b.HasIndex("DoctorId");
|
||||
|
||||
b.ToTable("Recipes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.DescriptionProcedure", b =>
|
||||
{
|
||||
b.HasOne("HospitalDatabaseImplement.Models.Pharmacist", "Pharmacist")
|
||||
.WithMany("DescriptionProcedures")
|
||||
.HasForeignKey("PharmacistId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Pharmacist");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.Disease", b =>
|
||||
{
|
||||
b.HasOne("HospitalDatabaseImplement.Models.Doctor", "Doctor")
|
||||
.WithMany("Diseases")
|
||||
.HasForeignKey("DoctorId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Doctor");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.Medicine", b =>
|
||||
{
|
||||
b.HasOne("HospitalDatabaseImplement.Models.Pharmacist", null)
|
||||
.WithMany("Medicines")
|
||||
.HasForeignKey("PharmacistId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.Patient", b =>
|
||||
{
|
||||
b.HasOne("HospitalDatabaseImplement.Models.Doctor", "Doctor")
|
||||
.WithMany("Patients")
|
||||
.HasForeignKey("DoctorId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Doctor");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.PatientProcedure", b =>
|
||||
{
|
||||
b.HasOne("HospitalDatabaseImplement.Models.Patient", "Patient")
|
||||
.WithMany("Procedures")
|
||||
.HasForeignKey("PatientId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("HospitalDatabaseImplement.Models.Procedure", "Procedure")
|
||||
.WithMany("PatientProcedures")
|
||||
.HasForeignKey("ProcedureId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Patient");
|
||||
|
||||
b.Navigation("Procedure");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.PatientRecipe", b =>
|
||||
{
|
||||
b.HasOne("HospitalDatabaseImplement.Models.Patient", "Patient")
|
||||
.WithMany("Recipes")
|
||||
.HasForeignKey("PatientId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("HospitalDatabaseImplement.Modelss.Recipe", "Recipe")
|
||||
.WithMany()
|
||||
.HasForeignKey("RecipeId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Patient");
|
||||
|
||||
b.Navigation("Recipe");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.Procedure", b =>
|
||||
{
|
||||
b.HasOne("HospitalDatabaseImplement.Models.DescriptionProcedure", "DescriptionProcedure")
|
||||
.WithMany("Procedures")
|
||||
.HasForeignKey("IDescriptionProcedureId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("HospitalDatabaseImplement.Models.Pharmacist", "Pharmacist")
|
||||
.WithMany("Procedures")
|
||||
.HasForeignKey("PharmacistId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("DescriptionProcedure");
|
||||
|
||||
b.Navigation("Pharmacist");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.ProcedureMedicine", b =>
|
||||
{
|
||||
b.HasOne("HospitalDatabaseImplement.Models.Medicine", "Medicine")
|
||||
.WithMany()
|
||||
.HasForeignKey("MedicineId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("HospitalDatabaseImplement.Models.Procedure", "Procedure")
|
||||
.WithMany("Medicines")
|
||||
.HasForeignKey("ProcedureId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Medicine");
|
||||
|
||||
b.Navigation("Procedure");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.RecipeMedicine", b =>
|
||||
{
|
||||
b.HasOne("HospitalDatabaseImplement.Models.Medicine", "Medicine")
|
||||
.WithMany("RecipeMedicines")
|
||||
.HasForeignKey("MedicineId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("HospitalDatabaseImplement.Modelss.Recipe", "Recipe")
|
||||
.WithMany("Medicines")
|
||||
.HasForeignKey("RecipeId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Medicine");
|
||||
|
||||
b.Navigation("Recipe");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Modelss.Recipe", b =>
|
||||
{
|
||||
b.HasOne("HospitalDatabaseImplement.Models.Disease", "Disease")
|
||||
.WithMany("Recipes")
|
||||
.HasForeignKey("DiseaseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("HospitalDatabaseImplement.Models.Doctor", "Doctor")
|
||||
.WithMany("Recipes")
|
||||
.HasForeignKey("DoctorId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Disease");
|
||||
|
||||
b.Navigation("Doctor");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.DescriptionProcedure", b =>
|
||||
{
|
||||
b.Navigation("Procedures");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.Disease", b =>
|
||||
{
|
||||
b.Navigation("Recipes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.Doctor", b =>
|
||||
{
|
||||
b.Navigation("Diseases");
|
||||
|
||||
b.Navigation("Patients");
|
||||
|
||||
b.Navigation("Recipes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.Medicine", b =>
|
||||
{
|
||||
b.Navigation("RecipeMedicines");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.Patient", b =>
|
||||
{
|
||||
b.Navigation("Procedures");
|
||||
|
||||
b.Navigation("Recipes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.Pharmacist", b =>
|
||||
{
|
||||
b.Navigation("DescriptionProcedures");
|
||||
|
||||
b.Navigation("Medicines");
|
||||
|
||||
b.Navigation("Procedures");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.Procedure", b =>
|
||||
{
|
||||
b.Navigation("Medicines");
|
||||
|
||||
b.Navigation("PatientProcedures");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Modelss.Recipe", b =>
|
||||
{
|
||||
b.Navigation("Medicines");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,173 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace HospitalDatabaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Hospital : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "Date",
|
||||
table: "Procedures",
|
||||
type: "datetime2",
|
||||
nullable: false,
|
||||
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "DescriptionProcedureId",
|
||||
table: "Procedures",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "IDescriptionProcedureId",
|
||||
table: "Procedures",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "PharmacistId",
|
||||
table: "Procedures",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Pharmacists",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Login = table.Column<string>(type: "nvarchar(25)", maxLength: 25, nullable: false),
|
||||
FIO = table.Column<string>(type: "nvarchar(55)", maxLength: 55, nullable: false),
|
||||
PhoneNumber = table.Column<string>(type: "nvarchar(11)", maxLength: 11, nullable: false),
|
||||
Password = table.Column<string>(type: "nvarchar(30)", maxLength: 30, nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Pharmacists", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "DescriptionProcedures",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
PharmacistId = table.Column<int>(type: "int", nullable: false),
|
||||
Description = table.Column<string>(type: "nvarchar(150)", maxLength: 150, nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_DescriptionProcedures", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_DescriptionProcedures_Pharmacists_PharmacistId",
|
||||
column: x => x.PharmacistId,
|
||||
principalTable: "Pharmacists",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Procedures_IDescriptionProcedureId",
|
||||
table: "Procedures",
|
||||
column: "IDescriptionProcedureId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Procedures_PharmacistId",
|
||||
table: "Procedures",
|
||||
column: "PharmacistId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Medicines_PharmacistId",
|
||||
table: "Medicines",
|
||||
column: "PharmacistId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_DescriptionProcedures_PharmacistId",
|
||||
table: "DescriptionProcedures",
|
||||
column: "PharmacistId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Medicines_Pharmacists_PharmacistId",
|
||||
table: "Medicines",
|
||||
column: "PharmacistId",
|
||||
principalTable: "Pharmacists",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Procedures_DescriptionProcedures_IDescriptionProcedureId",
|
||||
table: "Procedures",
|
||||
column: "IDescriptionProcedureId",
|
||||
principalTable: "DescriptionProcedures",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Procedures_Pharmacists_PharmacistId",
|
||||
table: "Procedures",
|
||||
column: "PharmacistId",
|
||||
principalTable: "Pharmacists",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Medicines_Pharmacists_PharmacistId",
|
||||
table: "Medicines");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Procedures_DescriptionProcedures_IDescriptionProcedureId",
|
||||
table: "Procedures");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Procedures_Pharmacists_PharmacistId",
|
||||
table: "Procedures");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "DescriptionProcedures");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Pharmacists");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Procedures_IDescriptionProcedureId",
|
||||
table: "Procedures");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Procedures_PharmacistId",
|
||||
table: "Procedures");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Medicines_PharmacistId",
|
||||
table: "Medicines");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Date",
|
||||
table: "Procedures");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "DescriptionProcedureId",
|
||||
table: "Procedures");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "IDescriptionProcedureId",
|
||||
table: "Procedures");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "PharmacistId",
|
||||
table: "Procedures");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.ViewModels;
|
||||
using HospitalDatabaseImplement.Modelss;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using HospitalDataModels.Models;
|
||||
|
||||
namespace HospitalDatabaseImplement.Models
|
||||
{
|
||||
public class DescriptionProcedure : IDescriptionProcedureModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public int PharmacistId { get; private set; }
|
||||
|
||||
public virtual Pharmacist Pharmacist { get; set; }
|
||||
|
||||
|
||||
[Required]
|
||||
[MaxLength(150)]
|
||||
public string Description { get; set; } = string.Empty;
|
||||
|
||||
[ForeignKey("IDescriptionProcedureId")]
|
||||
public virtual List<Procedure> Procedures { get; set; } = new();
|
||||
|
||||
public static DescriptionProcedure? Create(DescriptionProcedureBindingModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new DescriptionProcedure()
|
||||
{
|
||||
Id = model.Id,
|
||||
Description = model.Description,
|
||||
PharmacistId = model.PharmacistId
|
||||
};
|
||||
}
|
||||
|
||||
public static DescriptionProcedure Create(DescriptionProcedureViewModel model)
|
||||
{
|
||||
return new DescriptionProcedure
|
||||
{
|
||||
Id = model.Id,
|
||||
Description = model.Description
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(DescriptionProcedureBindingModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Description = model.Description;
|
||||
}
|
||||
|
||||
public DescriptionProcedureViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
Description = Description
|
||||
};
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
{
|
||||
"profiles": {
|
||||
"HospitalDatabaseImplement": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"applicationUrl": "https://localhost:51158;http://localhost:51165"
|
||||
}
|
||||
}
|
||||
}
|
@ -10,7 +10,7 @@ namespace HospitalDataModels.Models
|
||||
{
|
||||
string Name { get; }
|
||||
DateTime Date { get; }
|
||||
int DescriptionOfTheProcedureId { get; }
|
||||
int DescriptionProcedureId { get; }
|
||||
int PharmacistId { get; }
|
||||
Dictionary<int, IMedicineModel> ProcedureMedicines { get; }
|
||||
|
||||
|
12
Hospital/HospitalDataModels/Properties/launchSettings.json
Normal file
12
Hospital/HospitalDataModels/Properties/launchSettings.json
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"profiles": {
|
||||
"HospitalDataModels": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"applicationUrl": "https://localhost:51161;http://localhost:51166"
|
||||
}
|
||||
}
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
using HospitalContracts.SearchModels;
|
||||
using HospitalContracts.StoragesContracts;
|
||||
using HospitalContracts.ViewModels;
|
||||
using HospitalDatabaseImplement.Modelss;
|
||||
using HospitalDatabaseImplement.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -10,7 +10,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalDatabaseImplement.Implementss
|
||||
namespace HospitalDatabaseImplement.Implements
|
||||
{
|
||||
public class ProcedureStorage : IProcedureStorage
|
||||
{
|
||||
|
@ -22,6 +22,29 @@ namespace HospitalDatabaseImplement.Migrations
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.DescriptionProcedure", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasMaxLength(150)
|
||||
.HasColumnType("nvarchar(150)");
|
||||
|
||||
b.Property<int>("PharmacistId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("PharmacistId");
|
||||
|
||||
b.ToTable("DescriptionProcedures");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.Disease", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
@ -88,6 +111,36 @@ namespace HospitalDatabaseImplement.Migrations
|
||||
b.ToTable("Doctors");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.Medicine", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("CountryOrigin")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)");
|
||||
|
||||
b.Property<int>("PharmacistId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<double>("Price")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("PharmacistId");
|
||||
|
||||
b.ToTable("Medicines");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.Patient", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
@ -165,6 +218,96 @@ namespace HospitalDatabaseImplement.Migrations
|
||||
b.ToTable("PatientRecipes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.Pharmacist", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("FIO")
|
||||
.IsRequired()
|
||||
.HasMaxLength(55)
|
||||
.HasColumnType("nvarchar(55)");
|
||||
|
||||
b.Property<string>("Login")
|
||||
.IsRequired()
|
||||
.HasMaxLength(25)
|
||||
.HasColumnType("nvarchar(25)");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasMaxLength(30)
|
||||
.HasColumnType("nvarchar(30)");
|
||||
|
||||
b.Property<string>("PhoneNumber")
|
||||
.IsRequired()
|
||||
.HasMaxLength(11)
|
||||
.HasColumnType("nvarchar(11)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Pharmacists");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.Procedure", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("DescriptionProcedureId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("IDescriptionProcedureId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)");
|
||||
|
||||
b.Property<int>("PharmacistId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("IDescriptionProcedureId");
|
||||
|
||||
b.HasIndex("PharmacistId");
|
||||
|
||||
b.ToTable("Procedures");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.ProcedureMedicine", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("MedicineId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("ProcedureId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("MedicineId");
|
||||
|
||||
b.HasIndex("ProcedureId");
|
||||
|
||||
b.ToTable("ProcedureMedicines");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.RecipeMedicine", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
@ -188,75 +331,6 @@ namespace HospitalDatabaseImplement.Migrations
|
||||
b.ToTable("RecipeMedicines");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Modelss.Medicine", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("CountryOrigin")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)");
|
||||
|
||||
b.Property<int>("PharmacistId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<double>("Price")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Medicines");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Modelss.Procedure", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Procedures");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Modelss.ProcedureMedicine", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("MedicineId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("ProcedureId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("MedicineId");
|
||||
|
||||
b.HasIndex("ProcedureId");
|
||||
|
||||
b.ToTable("ProcedureMedicines");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Modelss.Recipe", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
@ -287,6 +361,17 @@ namespace HospitalDatabaseImplement.Migrations
|
||||
b.ToTable("Recipes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.DescriptionProcedure", b =>
|
||||
{
|
||||
b.HasOne("HospitalDatabaseImplement.Models.Pharmacist", "Pharmacist")
|
||||
.WithMany("DescriptionProcedures")
|
||||
.HasForeignKey("PharmacistId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Pharmacist");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.Disease", b =>
|
||||
{
|
||||
b.HasOne("HospitalDatabaseImplement.Models.Doctor", "Doctor")
|
||||
@ -298,6 +383,15 @@ namespace HospitalDatabaseImplement.Migrations
|
||||
b.Navigation("Doctor");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.Medicine", b =>
|
||||
{
|
||||
b.HasOne("HospitalDatabaseImplement.Models.Pharmacist", null)
|
||||
.WithMany("Medicines")
|
||||
.HasForeignKey("PharmacistId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.Patient", b =>
|
||||
{
|
||||
b.HasOne("HospitalDatabaseImplement.Models.Doctor", "Doctor")
|
||||
@ -317,7 +411,7 @@ namespace HospitalDatabaseImplement.Migrations
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("HospitalDatabaseImplement.Modelss.Procedure", "Procedure")
|
||||
b.HasOne("HospitalDatabaseImplement.Models.Procedure", "Procedure")
|
||||
.WithMany("PatientProcedures")
|
||||
.HasForeignKey("ProcedureId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
@ -347,9 +441,47 @@ namespace HospitalDatabaseImplement.Migrations
|
||||
b.Navigation("Recipe");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.Procedure", b =>
|
||||
{
|
||||
b.HasOne("HospitalDatabaseImplement.Models.DescriptionProcedure", "DescriptionProcedure")
|
||||
.WithMany("Procedures")
|
||||
.HasForeignKey("IDescriptionProcedureId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("HospitalDatabaseImplement.Models.Pharmacist", "Pharmacist")
|
||||
.WithMany("Procedures")
|
||||
.HasForeignKey("PharmacistId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("DescriptionProcedure");
|
||||
|
||||
b.Navigation("Pharmacist");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.ProcedureMedicine", b =>
|
||||
{
|
||||
b.HasOne("HospitalDatabaseImplement.Models.Medicine", "Medicine")
|
||||
.WithMany()
|
||||
.HasForeignKey("MedicineId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("HospitalDatabaseImplement.Models.Procedure", "Procedure")
|
||||
.WithMany("Medicines")
|
||||
.HasForeignKey("ProcedureId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Medicine");
|
||||
|
||||
b.Navigation("Procedure");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.RecipeMedicine", b =>
|
||||
{
|
||||
b.HasOne("HospitalDatabaseImplement.Modelss.Medicine", "Medicine")
|
||||
b.HasOne("HospitalDatabaseImplement.Models.Medicine", "Medicine")
|
||||
.WithMany("RecipeMedicines")
|
||||
.HasForeignKey("MedicineId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
@ -366,25 +498,6 @@ namespace HospitalDatabaseImplement.Migrations
|
||||
b.Navigation("Recipe");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Modelss.ProcedureMedicine", b =>
|
||||
{
|
||||
b.HasOne("HospitalDatabaseImplement.Modelss.Medicine", "Medicine")
|
||||
.WithMany()
|
||||
.HasForeignKey("MedicineId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("HospitalDatabaseImplement.Modelss.Procedure", "Procedure")
|
||||
.WithMany("Medicines")
|
||||
.HasForeignKey("ProcedureId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Medicine");
|
||||
|
||||
b.Navigation("Procedure");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Modelss.Recipe", b =>
|
||||
{
|
||||
b.HasOne("HospitalDatabaseImplement.Models.Disease", "Disease")
|
||||
@ -404,6 +517,11 @@ namespace HospitalDatabaseImplement.Migrations
|
||||
b.Navigation("Doctor");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.DescriptionProcedure", b =>
|
||||
{
|
||||
b.Navigation("Procedures");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.Disease", b =>
|
||||
{
|
||||
b.Navigation("Recipes");
|
||||
@ -418,6 +536,11 @@ namespace HospitalDatabaseImplement.Migrations
|
||||
b.Navigation("Recipes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.Medicine", b =>
|
||||
{
|
||||
b.Navigation("RecipeMedicines");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.Patient", b =>
|
||||
{
|
||||
b.Navigation("Procedures");
|
||||
@ -425,12 +548,16 @@ namespace HospitalDatabaseImplement.Migrations
|
||||
b.Navigation("Recipes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Modelss.Medicine", b =>
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.Pharmacist", b =>
|
||||
{
|
||||
b.Navigation("RecipeMedicines");
|
||||
b.Navigation("DescriptionProcedures");
|
||||
|
||||
b.Navigation("Medicines");
|
||||
|
||||
b.Navigation("Procedures");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Modelss.Procedure", b =>
|
||||
modelBuilder.Entity("HospitalDatabaseImplement.Models.Procedure", b =>
|
||||
{
|
||||
b.Navigation("Medicines");
|
||||
|
||||
|
@ -10,54 +10,10 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using HospitalDatabaseImplement.Models;
|
||||
|
||||
namespace HospitalDatabaseImplement.Modelss
|
||||
namespace HospitalDatabaseImplement.Models
|
||||
{
|
||||
public class Medicine : IMedicineModel
|
||||
public class Medicine
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
[MaxLength(50)]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public string CountryOrigin { get; set; } = string.Empty;
|
||||
public double Price { get; set; }
|
||||
public int PharmacistId { get; set; }
|
||||
|
||||
[ForeignKey("MedicineId")]
|
||||
public virtual List<RecipeMedicine> RecipeMedicines { get; set; } = new();
|
||||
|
||||
public static Medicine? Create(MedicineBindingModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new Medicine()
|
||||
{
|
||||
Id = model.Id,
|
||||
Name = model.Name
|
||||
};
|
||||
}
|
||||
public static Medicine Create(MedicineViewModel model)
|
||||
{
|
||||
return new Medicine
|
||||
{
|
||||
Id = model.Id,
|
||||
Name = model.Name
|
||||
};
|
||||
}
|
||||
public void Update(MedicineBindingModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Name = model.Name;
|
||||
}
|
||||
public MedicineViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
Name = Name
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -9,8 +9,9 @@ using System.Threading.Tasks;
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.ViewModels;
|
||||
using HospitalDataModels.Models;
|
||||
using HospitalDatabaseImplement.Models;
|
||||
|
||||
namespace HospitalDatabaseImplement.Modelss
|
||||
namespace HospitalDatabaseImplement.Models
|
||||
{
|
||||
public class Pharmacist : IPharmacistModel
|
||||
{
|
||||
@ -30,16 +31,16 @@ namespace HospitalDatabaseImplement.Modelss
|
||||
[MaxLength(30)]
|
||||
public string Password { get; set; } = string.Empty;
|
||||
|
||||
//[ForeignKey("PharmacistId")]
|
||||
//public virtual List<Patient> Patients { get; set; } = new();
|
||||
[ForeignKey("PharmacistId")]
|
||||
public virtual List<Medicine> Medicines { get; set; } = new();
|
||||
|
||||
//[ForeignKey("DoctorId")]
|
||||
//public virtual List<Recipe> Recipes { get; set; } = new();
|
||||
[ForeignKey("PharmacistId")]
|
||||
public virtual List<Procedure> Procedures { get; set; } = new();
|
||||
|
||||
// [ForeignKey("DoctorId")]
|
||||
// public virtual List<Disease> Diseases { get; set; } = new();
|
||||
[ForeignKey("PharmacistId")]
|
||||
public virtual List<DescriptionProcedure> DescriptionProcedures { get; set; } = new();
|
||||
|
||||
public static Pharmacist? Create(DoctorBindingModel model)
|
||||
public static Pharmacist? Create(PharmacistBindingModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
@ -53,7 +54,7 @@ namespace HospitalDatabaseImplement.Modelss
|
||||
Password = model.Password
|
||||
};
|
||||
}
|
||||
public static Pharmacist Create(DoctorViewModel model)
|
||||
public static Pharmacist Create(PharmacistViewModel model)
|
||||
{
|
||||
return new Pharmacist
|
||||
{
|
||||
@ -63,7 +64,7 @@ namespace HospitalDatabaseImplement.Modelss
|
||||
Password = model.Password
|
||||
};
|
||||
}
|
||||
public void Update(DoctorBindingModel model)
|
||||
public void Update(PharmacistBindingModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
@ -73,7 +74,7 @@ namespace HospitalDatabaseImplement.Modelss
|
||||
PhoneNumber = model.PhoneNumber;
|
||||
Password = model.Password;
|
||||
}
|
||||
public DoctorViewModel GetViewModel => new()
|
||||
public PharmacistViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
Login = Login,
|
||||
|
@ -9,8 +9,9 @@ using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using HospitalDatabaseImplement.Modelss;
|
||||
|
||||
namespace HospitalDatabaseImplement.Modelss
|
||||
namespace HospitalDatabaseImplement.Models
|
||||
{
|
||||
// TODO переделать под все необходимые атрибуты фармацевту
|
||||
public class Procedure : IProcedureModel
|
||||
@ -21,6 +22,7 @@ namespace HospitalDatabaseImplement.Modelss
|
||||
[MaxLength(50)]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
|
||||
[ForeignKey("ProcedureId")]
|
||||
public virtual List<PatientProcedure> PatientProcedures { get; set; } = new();
|
||||
|
||||
@ -66,12 +68,21 @@ namespace HospitalDatabaseImplement.Modelss
|
||||
Name = Name,
|
||||
ProcedureMedicines = ProcedureMedicines
|
||||
};
|
||||
[Required]
|
||||
|
||||
public DateTime Date { get; set; }
|
||||
[Required]
|
||||
|
||||
public int DescriptionProcedureId { get; set; }
|
||||
public virtual DescriptionProcedure DescriptionProcedure { get; set; }
|
||||
public int PharmacistId { get; private set; }
|
||||
|
||||
public DateTime Date => throw new NotImplementedException();
|
||||
public virtual Pharmacist Pharmacist { get; set; }
|
||||
// public DateTime Date => throw new NotImplementedException();
|
||||
|
||||
public int DescriptionOfTheProcedureId => throw new NotImplementedException();
|
||||
//public int DescriptionOfTheProcedureId => throw new NotImplementedException();
|
||||
|
||||
public int PharmacistId => throw new NotImplementedException();
|
||||
// public int PharmacistId => throw new NotImplementedException();
|
||||
|
||||
public void UpdateMedicines(HospitalDatabase context, ProcedureBindingModel model)
|
||||
{
|
||||
|
@ -1,11 +1,12 @@
|
||||
using System;
|
||||
using HospitalDatabaseImplement.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalDatabaseImplement.Modelss
|
||||
namespace HospitalDatabaseImplement.Models
|
||||
{
|
||||
public class ProcedureMedicine
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user