Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
        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);
        }