Начала делать БД

This commit is contained in:
Alenka 2024-04-27 23:17:05 +04:00
parent 9e8c7b46d2
commit e12f96bb3e
9 changed files with 247 additions and 0 deletions

View File

@ -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>

View 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
{
}
}

View File

@ -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
{
}
}

View 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
};
}
}

View 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 MedicineRecipes
{
}
}

View 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
};
}
}

View 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
{
}
}

View File

@ -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();
}
}

View 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
{
}
}