добавила модель рецепта и лекарства в хранилище

This commit is contained in:
Елена Бакальская 2024-04-28 20:05:31 +04:00
parent a7c7600073
commit b960f863f7
6 changed files with 83 additions and 16 deletions

View File

@ -7,7 +7,5 @@ namespace PolyclinicContracts.BindingModels
public int Id { get; set; }
public int ProceduresCount { get; set; }
public string Comment { get; set; } = string.Empty;
public Dictionary<int, IRecipeModel> ProcedureRecipes { get; set; } = new();
}
}

View File

@ -3,5 +3,6 @@
public class RecipeSearchModel
{
public int? Id { get; set; }
public string? Name { get; set; }
}
}

View File

@ -6,10 +6,11 @@ namespace PolyclinicContracts.ViewModels
public class RecipeViewModel : IRecipeModel
{
public int Id { get; set; }
[DisplayName("Количество процедур")]
public int ProceduresCount { get; set; }
[DisplayName("Комментарий")]
public string Comment { get; set; } = string.Empty;
public Dictionary<int, IRecipeModel> ProcedureRecipes { get; set; } = new();
}
}

View File

@ -4,7 +4,5 @@
{
int ProceduresCount { get; set; }
string Comment { get; set; }
Dictionary<int, IRecipeModel> ProcedureRecipes { get; }
}
}

View File

@ -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
{
public class Medicament : IMedicamentModel
{
public string Name => throw new NotImplementedException();
public string Comment => throw new NotImplementedException();
public int ProcedureId => throw new NotImplementedException();
public int SymptomId => throw new NotImplementedException();
public int Id => throw new NotImplementedException();
public int Id { get; set; }
[Required]
public string Name { get; set; } = string.Empty;
[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
};
}
}

View File

@ -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
{
public class Recipe : IRecipeModel
{
public int ProceduresCount { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public string Comment { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public Dictionary<int, IRecipeModel> ProcedureRecipes => throw new NotImplementedException();
public int Id => throw new NotImplementedException();
public int Id { get; set; }
[Required]
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
};
}
}