public static GeneralBloodAnalysisView EntityToView(this GeneralBloodAnalysis entity)
        {
            if (entity != null)
            {
                return(new GeneralBloodAnalysisView
                {
                    Id = entity.Id,
                    Info = entity.Info,
                    MedicalExaminationId = entity.MedicalExaminationId
                });
            }

            return(null);
        }
Example #2
0
        public void InsertGeneralBloodAnalysis(int id, GeneralBloodAnalysis generalBloodAnalysis)
        {
            var entity = context.MedicalExaminations.FirstOrDefault(t => t.Id == id);

            if (entity == null)
            {
                throw new NullReferenceException();
            }

            generalBloodAnalysis.Id = 0;
            entity.GeneralBloodAnalyses.Add(generalBloodAnalysis);

            context.SaveChanges();
        }