Реализована модель сущности диагноз для бд
This commit is contained in:
parent
bc32dba8f9
commit
21d08fdfa1
50
Polyclinic/PolyclinicDatabaseImplement/Models/Diagnose.cs
Normal file
50
Polyclinic/PolyclinicDatabaseImplement/Models/Diagnose.cs
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
using PolyclinicContracts.BindingModels;
|
||||||
|
using PolyclinicContracts.ViewModels;
|
||||||
|
using PolyclinicDataModels.Models;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace PolyclinicDatabaseImplement.Models
|
||||||
|
{
|
||||||
|
public class Diagnose : IDiagnoseModel
|
||||||
|
{
|
||||||
|
[Required]
|
||||||
|
public string Name { get; private set; } = string.Empty;
|
||||||
|
[Required]
|
||||||
|
public string Comment { get; private set; } = string.Empty;
|
||||||
|
[Required]
|
||||||
|
public int UserId { get; private set; }
|
||||||
|
public int Id { get; private set; }
|
||||||
|
public static Diagnose? Create(DiagnoseBindingModel? model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new Diagnose
|
||||||
|
{
|
||||||
|
Name = model.Name,
|
||||||
|
Comment = model.Comment,
|
||||||
|
UserId = model.UserId,
|
||||||
|
Id = model.Id
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update(DiagnoseBindingModel? model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Name = model.Name;
|
||||||
|
Comment = model.Comment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DiagnoseViewModel GetViewModel => new()
|
||||||
|
{
|
||||||
|
Name = Name,
|
||||||
|
Comment = Comment,
|
||||||
|
UserId = UserId,
|
||||||
|
Id = Id
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="Implements\" />
|
<Folder Include="Implements\" />
|
||||||
<Folder Include="Models\" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@ -16,4 +15,9 @@
|
|||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.16" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.16" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\PolyclinicContracts\PolyclinicContracts.csproj" />
|
||||||
|
<ProjectReference Include="..\PolyclinicDataModels\PolyclinicDataModels.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
Loading…
Reference in New Issue
Block a user