public void InsertGeneralUrineAnalysis(int id, GeneralUrineAnalysis generalUrineAnalysis) { var entity = context.MedicalExaminations.FirstOrDefault(t => t.Id == id); if (entity == null) { throw new NullReferenceException(); } generalUrineAnalysis.Id = 0; entity.GeneralUrineAnalyses.Add(generalUrineAnalysis); context.SaveChanges(); }
public static GeneralUrineAnalysisView EntityToView(this GeneralUrineAnalysis entity) { if (entity != null) { return(new GeneralUrineAnalysisView { Id = entity.Id, Info = entity.Info, MedicalExaminationId = entity.MedicalExaminationId }); } return(null); }