using System; using System.Linq.Expressions; using DocuMed.Domain.Dtos.SmallDtos; using DocuMed.Domain.Entities.User; namespace DocuMed.Domain.Mappers { public static partial class ApplicationUserMapper { public static ApplicationUser AdaptToApplicationUser(this ApplicationUserSDto p1) { return p1 == null ? null : new ApplicationUser() { FirstName = p1.FirstName, LastName = p1.LastName, NationalId = p1.NationalId, Section = p1.Section, BirthDate = p1.BirthDate, Gender = p1.Gender, SignUpStatus = p1.SignUpStatus, UniversityId = (Guid?)p1.UniversityId, Id = p1.Id, UserName = p1.UserName, Email = p1.Email, PhoneNumber = p1.PhoneNumber, PhoneNumberConfirmed = p1.PhoneNumberConfirmed }; } public static ApplicationUser AdaptTo(this ApplicationUserSDto p2, ApplicationUser p3) { if (p2 == null) { return null; } ApplicationUser result = p3 ?? new ApplicationUser(); result.FirstName = p2.FirstName; result.LastName = p2.LastName; result.NationalId = p2.NationalId; result.Section = p2.Section; result.BirthDate = p2.BirthDate; result.Gender = p2.Gender; result.SignUpStatus = p2.SignUpStatus; result.UniversityId = (Guid?)p2.UniversityId; result.Id = p2.Id; result.UserName = p2.UserName; result.Email = p2.Email; result.PhoneNumber = p2.PhoneNumber; result.PhoneNumberConfirmed = p2.PhoneNumberConfirmed; return result; } public static Expression> ProjectToApplicationUser => p4 => new ApplicationUser() { FirstName = p4.FirstName, LastName = p4.LastName, NationalId = p4.NationalId, Section = p4.Section, BirthDate = p4.BirthDate, Gender = p4.Gender, SignUpStatus = p4.SignUpStatus, UniversityId = (Guid?)p4.UniversityId, Id = p4.Id, UserName = p4.UserName, Email = p4.Email, PhoneNumber = p4.PhoneNumber, PhoneNumberConfirmed = p4.PhoneNumberConfirmed }; public static ApplicationUserSDto AdaptToSDto(this ApplicationUser p5) { return p5 == null ? null : new ApplicationUserSDto() { FirstName = p5.FirstName, LastName = p5.LastName, UserName = p5.UserName, Email = p5.Email, PhoneNumber = p5.PhoneNumber, PhoneNumberConfirmed = p5.PhoneNumberConfirmed, NationalId = p5.NationalId, Section = p5.Section, BirthDate = p5.BirthDate, Gender = p5.Gender, SignUpStatus = p5.SignUpStatus, UniversityId = p5.UniversityId == null ? default(Guid) : (Guid)p5.UniversityId, Id = p5.Id }; } public static ApplicationUserSDto AdaptTo(this ApplicationUser p6, ApplicationUserSDto p7) { if (p6 == null) { return null; } ApplicationUserSDto result = p7 ?? new ApplicationUserSDto(); result.FirstName = p6.FirstName; result.LastName = p6.LastName; result.UserName = p6.UserName; result.Email = p6.Email; result.PhoneNumber = p6.PhoneNumber; result.PhoneNumberConfirmed = p6.PhoneNumberConfirmed; result.NationalId = p6.NationalId; result.Section = p6.Section; result.BirthDate = p6.BirthDate; result.Gender = p6.Gender; result.SignUpStatus = p6.SignUpStatus; result.UniversityId = p6.UniversityId == null ? default(Guid) : (Guid)p6.UniversityId; result.Id = p6.Id; return result; } public static Expression> ProjectToSDto => p8 => new ApplicationUserSDto() { FirstName = p8.FirstName, LastName = p8.LastName, UserName = p8.UserName, Email = p8.Email, PhoneNumber = p8.PhoneNumber, PhoneNumberConfirmed = p8.PhoneNumberConfirmed, NationalId = p8.NationalId, Section = p8.Section, BirthDate = p8.BirthDate, Gender = p8.Gender, SignUpStatus = p8.SignUpStatus, UniversityId = p8.UniversityId == null ? default(Guid) : (Guid)p8.UniversityId, Id = p8.Id }; } }