добавила модель рецепта и лекарства в хранилище
This commit is contained in:
parent
a7c7600073
commit
b960f863f7
@ -7,7 +7,5 @@ namespace PolyclinicContracts.BindingModels
|
|||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public int ProceduresCount { get; set; }
|
public int ProceduresCount { get; set; }
|
||||||
public string Comment { get; set; } = string.Empty;
|
public string Comment { get; set; } = string.Empty;
|
||||||
public Dictionary<int, IRecipeModel> ProcedureRecipes { get; set; } = new();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -3,5 +3,6 @@
|
|||||||
public class RecipeSearchModel
|
public class RecipeSearchModel
|
||||||
{
|
{
|
||||||
public int? Id { get; set; }
|
public int? Id { get; set; }
|
||||||
|
public string? Name { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -6,10 +6,11 @@ namespace PolyclinicContracts.ViewModels
|
|||||||
public class RecipeViewModel : IRecipeModel
|
public class RecipeViewModel : IRecipeModel
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
[DisplayName("Количество процедур")]
|
[DisplayName("Количество процедур")]
|
||||||
public int ProceduresCount { get; set; }
|
public int ProceduresCount { get; set; }
|
||||||
|
|
||||||
[DisplayName("Комментарий")]
|
[DisplayName("Комментарий")]
|
||||||
public string Comment { get; set; } = string.Empty;
|
public string Comment { get; set; } = string.Empty;
|
||||||
public Dictionary<int, IRecipeModel> ProcedureRecipes { get; set; } = new();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,5 @@
|
|||||||
{
|
{
|
||||||
int ProceduresCount { get; set; }
|
int ProceduresCount { get; set; }
|
||||||
string Comment { get; set; }
|
string Comment { get; set; }
|
||||||
Dictionary<int, IRecipeModel> ProcedureRecipes { get; }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,13 +1,52 @@
|
|||||||
using PolyclinicDataModels.Models;
|
using PolyclinicContracts.BindingModels;
|
||||||
|
using PolyclinicContracts.ViewModels;
|
||||||
|
using PolyclinicDataModels.Models;
|
||||||
|
using SecuritySystemDatabaseImplement;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace PolyclinicDatabaseImplement.Models
|
namespace PolyclinicDatabaseImplement.Models
|
||||||
{
|
{
|
||||||
public class Medicament : IMedicamentModel
|
public class Medicament : IMedicamentModel
|
||||||
{
|
{
|
||||||
public string Name => throw new NotImplementedException();
|
public int Id { get; set; }
|
||||||
public string Comment => throw new NotImplementedException();
|
|
||||||
public int ProcedureId => throw new NotImplementedException();
|
[Required]
|
||||||
public int SymptomId => throw new NotImplementedException();
|
public string Name { get; set; } = string.Empty;
|
||||||
public int Id => throw new NotImplementedException();
|
|
||||||
|
[Required]
|
||||||
|
public string Comment { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
public int ProcedureId { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
public int SymptomId { get; set; }
|
||||||
|
|
||||||
|
public static Medicament Create(PolyclinicDatabase database, MedicamentBindingModel bindingModel)
|
||||||
|
{
|
||||||
|
return new Medicament()
|
||||||
|
{
|
||||||
|
Id = bindingModel.Id,
|
||||||
|
Name = bindingModel.Name,
|
||||||
|
Comment = bindingModel.Comment,
|
||||||
|
ProcedureId = bindingModel.ProcedureId,
|
||||||
|
SymptomId = bindingModel.SymptomId
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update(MedicamentBindingModel bindingModel)
|
||||||
|
{
|
||||||
|
Name = bindingModel.Name;
|
||||||
|
Comment = bindingModel.Comment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MedicamentViewModel GetViewModel => new()
|
||||||
|
{
|
||||||
|
Id = Id,
|
||||||
|
Name = Name,
|
||||||
|
Comment = Comment,
|
||||||
|
ProcedureId = ProcedureId,
|
||||||
|
SymptomId = SymptomId
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,42 @@
|
|||||||
using PolyclinicDataModels.Models;
|
using PolyclinicContracts.BindingModels;
|
||||||
|
using PolyclinicContracts.ViewModels;
|
||||||
|
using PolyclinicDataModels.Models;
|
||||||
|
using SecuritySystemDatabaseImplement;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace PolyclinicDatabaseImplement.Models
|
namespace PolyclinicDatabaseImplement.Models
|
||||||
{
|
{
|
||||||
public class Recipe : IRecipeModel
|
public class Recipe : IRecipeModel
|
||||||
{
|
{
|
||||||
public int ProceduresCount { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
public int Id { get; set; }
|
||||||
public string Comment { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
|
||||||
public Dictionary<int, IRecipeModel> ProcedureRecipes => throw new NotImplementedException();
|
[Required]
|
||||||
public int Id => throw new NotImplementedException();
|
public int ProceduresCount { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
public string Comment { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public static Recipe Create(PolyclinicDatabase database, RecipeBindingModel bindingModel)
|
||||||
|
{
|
||||||
|
return new Recipe()
|
||||||
|
{
|
||||||
|
Id = bindingModel.Id,
|
||||||
|
ProceduresCount = bindingModel.ProceduresCount,
|
||||||
|
Comment = bindingModel.Comment,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update(RecipeBindingModel bindingModel)
|
||||||
|
{
|
||||||
|
ProceduresCount = bindingModel.ProceduresCount;
|
||||||
|
Comment = bindingModel.Comment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RecipeViewModel GetViewModel => new()
|
||||||
|
{
|
||||||
|
Id = Id,
|
||||||
|
ProceduresCount = ProceduresCount,
|
||||||
|
Comment = Comment
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user