2024-04-28 20:05:31 +04:00
|
|
|
|
using PolyclinicContracts.BindingModels;
|
|
|
|
|
using PolyclinicContracts.ViewModels;
|
|
|
|
|
using PolyclinicDataModels.Models;
|
|
|
|
|
using SecuritySystemDatabaseImplement;
|
|
|
|
|
using System.ComponentModel.DataAnnotations;
|
2024-04-28 16:24:52 +04:00
|
|
|
|
|
|
|
|
|
namespace PolyclinicDatabaseImplement.Models
|
|
|
|
|
{
|
|
|
|
|
public class Recipe : IRecipeModel
|
|
|
|
|
{
|
2024-04-28 20:05:31 +04:00
|
|
|
|
public int Id { get; set; }
|
|
|
|
|
|
|
|
|
|
[Required]
|
|
|
|
|
public int ProceduresCount { get; set; }
|
|
|
|
|
|
|
|
|
|
[Required]
|
|
|
|
|
public string Comment { get; set; } = string.Empty;
|
|
|
|
|
|
2024-04-28 21:41:17 +04:00
|
|
|
|
public static Recipe Create( RecipeBindingModel bindingModel)
|
2024-04-28 20:05:31 +04:00
|
|
|
|
{
|
|
|
|
|
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
|
|
|
|
|
};
|
2024-04-28 16:24:52 +04:00
|
|
|
|
}
|
|
|
|
|
}
|