Начала делать БД
This commit is contained in:
parent
9e8c7b46d2
commit
e12f96bb3e
@ -6,4 +6,13 @@
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\HospitalContracts\HospitalContracts.csproj" />
|
||||
<ProjectReference Include="..\HospitalDataModels\HospitalDataModels.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
14
Hospital/HospitalDataBaseImplement/HospitalDatabase.cs
Normal file
14
Hospital/HospitalDataBaseImplement/HospitalDatabase.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
namespace HospitalDatabaseImplement
|
||||
{
|
||||
public class HospitalDatabase
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
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;
|
||||
|
||||
|
||||
namespace HospitalDatabaseImplement.Implementss
|
||||
{
|
||||
public class MedicineStorage
|
||||
{
|
||||
|
||||
}
|
||||
}
|
62
Hospital/HospitalDataBaseImplement/Modelss/Medicine.cs
Normal file
62
Hospital/HospitalDataBaseImplement/Modelss/Medicine.cs
Normal file
@ -0,0 +1,62 @@
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.ViewModels;
|
||||
using HospitalDataModels.Models;
|
||||
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;
|
||||
|
||||
namespace HospitalDatabaseImplement.Modelss
|
||||
{
|
||||
public class Medicine : IMedicineModel
|
||||
{
|
||||
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<MedicineRecipes> 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
|
||||
};
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalDatabaseImplement.Modelss
|
||||
{
|
||||
public class MedicineRecipes
|
||||
{
|
||||
}
|
||||
}
|
84
Hospital/HospitalDataBaseImplement/Modelss/Pharmacist.cs
Normal file
84
Hospital/HospitalDataBaseImplement/Modelss/Pharmacist.cs
Normal file
@ -0,0 +1,84 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using HospitalContracts.BindingModels;
|
||||
using HospitalContracts.ViewModels;
|
||||
using HospitalDataModels.Models;
|
||||
|
||||
namespace HospitalDatabaseImplement.Modelss
|
||||
{
|
||||
public class Pharmacist : IPharmacistModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
[MaxLength(25)]
|
||||
public string Login { get; set; } = string.Empty;
|
||||
[Required]
|
||||
[MaxLength(55)]
|
||||
public string FIO { get; set; } = string.Empty;
|
||||
[Required]
|
||||
[MaxLength(11)]
|
||||
public string PhoneNumber { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
[MaxLength(30)]
|
||||
public string Password { get; set; } = string.Empty;
|
||||
|
||||
//[ForeignKey("PharmacistId")]
|
||||
//public virtual List<Patient> Patients { get; set; } = new();
|
||||
|
||||
//[ForeignKey("DoctorId")]
|
||||
//public virtual List<Recipe> Recipes { get; set; } = new();
|
||||
|
||||
// [ForeignKey("DoctorId")]
|
||||
// public virtual List<Disease> Diseases { get; set; } = new();
|
||||
|
||||
public static Pharmacist? Create(DoctorBindingModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new Pharmacist()
|
||||
{
|
||||
Id = model.Id,
|
||||
Login = model.Login,
|
||||
PhoneNumber = model.PhoneNumber,
|
||||
Password = model.Password
|
||||
};
|
||||
}
|
||||
public static Pharmacist Create(DoctorViewModel model)
|
||||
{
|
||||
return new Pharmacist
|
||||
{
|
||||
Id = model.Id,
|
||||
Login = model.Login,
|
||||
PhoneNumber = model.PhoneNumber,
|
||||
Password = model.Password
|
||||
};
|
||||
}
|
||||
public void Update(DoctorBindingModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Login = model.Login;
|
||||
PhoneNumber = model.PhoneNumber;
|
||||
Password = model.Password;
|
||||
}
|
||||
public DoctorViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
Login = Login,
|
||||
PhoneNumber = PhoneNumber,
|
||||
Password = Password
|
||||
};
|
||||
}
|
||||
}
|
12
Hospital/HospitalDataBaseImplement/Modelss/Procedure.cs
Normal file
12
Hospital/HospitalDataBaseImplement/Modelss/Procedure.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalDatabaseImplement.Modelss
|
||||
{
|
||||
public class Procedure
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalDatabaseImplement.Modelss
|
||||
{
|
||||
public class ProcedureMedicine
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
public int RecipeId { get; set; }
|
||||
|
||||
[Required]
|
||||
public int MedicineId { get; set; }
|
||||
|
||||
public virtual Recipe Recipe { get; set; } = new();
|
||||
|
||||
public virtual Medicine Medicine { get; set; } = new();
|
||||
}
|
||||
}
|
12
Hospital/HospitalDataBaseImplement/Modelss/Recipe.cs
Normal file
12
Hospital/HospitalDataBaseImplement/Modelss/Recipe.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HospitalDatabaseImplement.Modelss
|
||||
{
|
||||
public class Recipe
|
||||
{
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user