using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using DocuMed.Domain.Dtos.LargDtos; using DocuMed.Domain.Dtos.SmallDtos; using DocuMed.Domain.Entities.City; using DocuMed.Domain.Entities.MedicalHistoryTemplate; namespace DocuMed.Domain.Mappers { public static partial class MedicalHistoryTemplateMapper { public static MedicalHistoryTemplate AdaptToMedicalHistoryTemplate(this MedicalHistoryTemplateSDto p1) { return p1 == null ? null : new MedicalHistoryTemplate() { ChiefComplaint = p1.ChiefComplaint, SectionId = p1.SectionId, ApplicationUserId = p1.ApplicationUserId, Id = p1.Id }; } public static MedicalHistoryTemplate AdaptTo(this MedicalHistoryTemplateSDto p2, MedicalHistoryTemplate p3) { if (p2 == null) { return null; } MedicalHistoryTemplate result = p3 ?? new MedicalHistoryTemplate(); result.ChiefComplaint = p2.ChiefComplaint; result.SectionId = p2.SectionId; result.ApplicationUserId = p2.ApplicationUserId; result.Id = p2.Id; return result; } public static Expression> ProjectToMedicalHistoryTemplate => p4 => new MedicalHistoryTemplate() { ChiefComplaint = p4.ChiefComplaint, SectionId = p4.SectionId, ApplicationUserId = p4.ApplicationUserId, Id = p4.Id }; public static MedicalHistoryTemplateSDto AdaptToSDto(this MedicalHistoryTemplate p5) { return p5 == null ? null : new MedicalHistoryTemplateSDto() { ChiefComplaint = p5.ChiefComplaint, SectionName = p5.Section == null ? null : p5.Section.Name, SectionId = p5.SectionId, ApplicationUserId = p5.ApplicationUserId, Id = p5.Id }; } public static MedicalHistoryTemplateSDto AdaptTo(this MedicalHistoryTemplate p6, MedicalHistoryTemplateSDto p7) { if (p6 == null) { return null; } MedicalHistoryTemplateSDto result = p7 ?? new MedicalHistoryTemplateSDto(); result.ChiefComplaint = p6.ChiefComplaint; result.SectionName = p6.Section == null ? null : p6.Section.Name; result.SectionId = p6.SectionId; result.ApplicationUserId = p6.ApplicationUserId; result.Id = p6.Id; return result; } public static Expression> ProjectToSDto => p8 => new MedicalHistoryTemplateSDto() { ChiefComplaint = p8.ChiefComplaint, SectionName = p8.Section.Name, SectionId = p8.SectionId, ApplicationUserId = p8.ApplicationUserId, Id = p8.Id }; public static MedicalHistoryTemplate AdaptToMedicalHistoryTemplate(this MedicalHistoryTemplateLDto p9) { return p9 == null ? null : new MedicalHistoryTemplate() { ChiefComplaint = p9.ChiefComplaint, SectionId = p9.SectionId, Section = p9.Section == null ? null : new Section() { Name = p9.Section.Name, Detail = p9.Section.Detail, UniversityId = p9.Section.UniversityId, Id = p9.Section.Id }, ApplicationUserId = p9.ApplicationUserId, Questions = funcMain1(p9.Questions), Id = p9.Id }; } public static MedicalHistoryTemplate AdaptTo(this MedicalHistoryTemplateLDto p11, MedicalHistoryTemplate p12) { if (p11 == null) { return null; } MedicalHistoryTemplate result = p12 ?? new MedicalHistoryTemplate(); result.ChiefComplaint = p11.ChiefComplaint; result.SectionId = p11.SectionId; result.Section = funcMain2(p11.Section, result.Section); result.ApplicationUserId = p11.ApplicationUserId; result.Questions = funcMain3(p11.Questions, result.Questions); result.Id = p11.Id; return result; } public static Expression> ProjectLDtoToMedicalHistoryTemplate => p17 => new MedicalHistoryTemplate() { ChiefComplaint = p17.ChiefComplaint, SectionId = p17.SectionId, Section = p17.Section == null ? null : new Section() { Name = p17.Section.Name, Detail = p17.Section.Detail, UniversityId = p17.Section.UniversityId, Id = p17.Section.Id }, ApplicationUserId = p17.ApplicationUserId, Questions = p17.Questions.Select(p18 => new MedicalHistoryQuestion() { Question = p18.Question, Part = p18.Part, QuestionType = p18.QuestionType, BodySystem = p18.BodySystem, IsSign = p18.IsSign, IsSymptom = p18.IsSymptom, MedicalHistoryTemplateId = p18.MedicalHistoryTemplateId, Id = p18.Id }).ToList(), Id = p17.Id }; public static MedicalHistoryTemplateLDto AdaptToLDto(this MedicalHistoryTemplate p19) { return p19 == null ? null : new MedicalHistoryTemplateLDto() { ChiefComplaint = p19.ChiefComplaint, SectionId = p19.SectionId, Section = p19.Section == null ? null : new SectionSDto() { Name = p19.Section.Name, Detail = p19.Section.Detail, UniversityId = p19.Section.UniversityId, Id = p19.Section.Id }, ApplicationUserId = p19.ApplicationUserId, Questions = funcMain4(p19.Questions), Id = p19.Id }; } public static MedicalHistoryTemplateLDto AdaptTo(this MedicalHistoryTemplate p21, MedicalHistoryTemplateLDto p22) { if (p21 == null) { return null; } MedicalHistoryTemplateLDto result = p22 ?? new MedicalHistoryTemplateLDto(); result.ChiefComplaint = p21.ChiefComplaint; result.SectionId = p21.SectionId; result.Section = funcMain5(p21.Section, result.Section); result.ApplicationUserId = p21.ApplicationUserId; result.Questions = funcMain6(p21.Questions, result.Questions); result.Id = p21.Id; return result; } public static Expression> ProjectToLDto => p27 => new MedicalHistoryTemplateLDto() { ChiefComplaint = p27.ChiefComplaint, SectionId = p27.SectionId, Section = p27.Section == null ? null : new SectionSDto() { Name = p27.Section.Name, Detail = p27.Section.Detail, UniversityId = p27.Section.UniversityId, Id = p27.Section.Id }, ApplicationUserId = p27.ApplicationUserId, Questions = p27.Questions.Select(p28 => new MedicalHistoryQuestionSDto() { Question = p28.Question, Part = p28.Part, QuestionType = p28.QuestionType, MedicalHistoryTemplateId = p28.MedicalHistoryTemplateId, BodySystem = p28.BodySystem, IsSign = p28.IsSign, IsSymptom = p28.IsSymptom, Id = p28.Id }).ToList(), Id = p27.Id }; private static List funcMain1(List p10) { if (p10 == null) { return null; } List result = new List(p10.Count); int i = 0; int len = p10.Count; while (i < len) { MedicalHistoryQuestionSDto item = p10[i]; result.Add(item == null ? null : new MedicalHistoryQuestion() { Question = item.Question, Part = item.Part, QuestionType = item.QuestionType, BodySystem = item.BodySystem, IsSign = item.IsSign, IsSymptom = item.IsSymptom, MedicalHistoryTemplateId = item.MedicalHistoryTemplateId, Id = item.Id }); i++; } return result; } private static Section funcMain2(SectionSDto p13, Section p14) { if (p13 == null) { return null; } Section result = p14 ?? new Section(); result.Name = p13.Name; result.Detail = p13.Detail; result.UniversityId = p13.UniversityId; result.Id = p13.Id; return result; } private static List funcMain3(List p15, List p16) { if (p15 == null) { return null; } List result = new List(p15.Count); int i = 0; int len = p15.Count; while (i < len) { MedicalHistoryQuestionSDto item = p15[i]; result.Add(item == null ? null : new MedicalHistoryQuestion() { Question = item.Question, Part = item.Part, QuestionType = item.QuestionType, BodySystem = item.BodySystem, IsSign = item.IsSign, IsSymptom = item.IsSymptom, MedicalHistoryTemplateId = item.MedicalHistoryTemplateId, Id = item.Id }); i++; } return result; } private static List funcMain4(List p20) { if (p20 == null) { return null; } List result = new List(p20.Count); int i = 0; int len = p20.Count; while (i < len) { MedicalHistoryQuestion item = p20[i]; result.Add(item == null ? null : new MedicalHistoryQuestionSDto() { Question = item.Question, Part = item.Part, QuestionType = item.QuestionType, MedicalHistoryTemplateId = item.MedicalHistoryTemplateId, BodySystem = item.BodySystem, IsSign = item.IsSign, IsSymptom = item.IsSymptom, Id = item.Id }); i++; } return result; } private static SectionSDto funcMain5(Section p23, SectionSDto p24) { if (p23 == null) { return null; } SectionSDto result = p24 ?? new SectionSDto(); result.Name = p23.Name; result.Detail = p23.Detail; result.UniversityId = p23.UniversityId; result.Id = p23.Id; return result; } private static List funcMain6(List p25, List p26) { if (p25 == null) { return null; } List result = new List(p25.Count); int i = 0; int len = p25.Count; while (i < len) { MedicalHistoryQuestion item = p25[i]; result.Add(item == null ? null : new MedicalHistoryQuestionSDto() { Question = item.Question, Part = item.Part, QuestionType = item.QuestionType, MedicalHistoryTemplateId = item.MedicalHistoryTemplateId, BodySystem = item.BodySystem, IsSign = item.IsSign, IsSymptom = item.IsSymptom, Id = item.Id }); i++; } return result; } } }