using System; using System.Linq.Expressions; using DocuMed.Domain.Dtos.SmallDtos; using DocuMed.Domain.Entities.MedicalHistoryTemplate; namespace DocuMed.Domain.Mappers { public static partial class MedicalHistoryQuestionMapper { public static MedicalHistoryQuestion AdaptToMedicalHistoryQuestion(this MedicalHistoryQuestionSDto p1) { return p1 == null ? null : new MedicalHistoryQuestion() { Question = p1.Question, Part = p1.Part, QuestionType = p1.QuestionType, BodySystem = p1.BodySystem, IsSign = p1.IsSign, IsSymptom = p1.IsSymptom, MedicalHistoryTemplateId = p1.MedicalHistoryTemplateId, Id = p1.Id }; } public static MedicalHistoryQuestion AdaptTo(this MedicalHistoryQuestionSDto p2, MedicalHistoryQuestion p3) { if (p2 == null) { return null; } MedicalHistoryQuestion result = p3 ?? new MedicalHistoryQuestion(); result.Question = p2.Question; result.Part = p2.Part; result.QuestionType = p2.QuestionType; result.BodySystem = p2.BodySystem; result.IsSign = p2.IsSign; result.IsSymptom = p2.IsSymptom; result.MedicalHistoryTemplateId = p2.MedicalHistoryTemplateId; result.Id = p2.Id; return result; } public static MedicalHistoryQuestionSDto AdaptToSDto(this MedicalHistoryQuestion p4) { return p4 == null ? null : new MedicalHistoryQuestionSDto() { Question = p4.Question, Part = p4.Part, QuestionType = p4.QuestionType, MedicalHistoryTemplateId = p4.MedicalHistoryTemplateId, BodySystem = p4.BodySystem, IsSign = p4.IsSign, IsSymptom = p4.IsSymptom, Id = p4.Id }; } public static MedicalHistoryQuestionSDto AdaptTo(this MedicalHistoryQuestion p5, MedicalHistoryQuestionSDto p6) { if (p5 == null) { return null; } MedicalHistoryQuestionSDto result = p6 ?? new MedicalHistoryQuestionSDto(); result.Question = p5.Question; result.Part = p5.Part; result.QuestionType = p5.QuestionType; result.MedicalHistoryTemplateId = p5.MedicalHistoryTemplateId; result.BodySystem = p5.BodySystem; result.IsSign = p5.IsSign; result.IsSymptom = p5.IsSymptom; result.Id = p5.Id; return result; } public static Expression> ProjectToSDto => p7 => new MedicalHistoryQuestionSDto() { Question = p7.Question, Part = p7.Part, QuestionType = p7.QuestionType, MedicalHistoryTemplateId = p7.MedicalHistoryTemplateId, BodySystem = p7.BodySystem, IsSign = p7.IsSign, IsSymptom = p7.IsSymptom, Id = p7.Id }; } }