public void InsertSurgicalIntervention(int id, SurgicalIntervention surgicalIntervention) { var entity = context.GeneralInformation.FirstOrDefault(t => t.Id == id); if (entity == null) { throw new NullReferenceException(); } surgicalIntervention.Id = 0; entity.SurgicalIntervention.Add(surgicalIntervention); context.SaveChanges(); }
public static SurgicalInterventionView EntityToView(this SurgicalIntervention entity) { if (entity != null) { return(new SurgicalInterventionView { Id = entity.Id, ProcedureTime = entity.ProcedureTime, Diagnosis = entity.Diagnosis, InterventionType = entity.InterventionType, GeneralInformationId = entity.GeneralInformationId }); } return(null); }