117 lines
		
	
	
		
			4.2 KiB
		
	
	
	
		
			C#
		
	
	
			
		
		
	
	
			117 lines
		
	
	
		
			4.2 KiB
		
	
	
	
		
			C#
		
	
	
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,
 | 
						|
                BirthDate = p1.BirthDate,
 | 
						|
                Gender = p1.Gender,
 | 
						|
                SignUpStatus = p1.SignUpStatus,
 | 
						|
                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.BirthDate = p2.BirthDate;
 | 
						|
            result.Gender = p2.Gender;
 | 
						|
            result.SignUpStatus = p2.SignUpStatus;
 | 
						|
            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<Func<ApplicationUserSDto, ApplicationUser>> ProjectToApplicationUser => p4 => new ApplicationUser()
 | 
						|
        {
 | 
						|
            FirstName = p4.FirstName,
 | 
						|
            LastName = p4.LastName,
 | 
						|
            NationalId = p4.NationalId,
 | 
						|
            BirthDate = p4.BirthDate,
 | 
						|
            Gender = p4.Gender,
 | 
						|
            SignUpStatus = p4.SignUpStatus,
 | 
						|
            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,
 | 
						|
                BirthDate = p5.BirthDate,
 | 
						|
                Gender = p5.Gender,
 | 
						|
                SignUpStatus = p5.SignUpStatus,
 | 
						|
                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.BirthDate = p6.BirthDate;
 | 
						|
            result.Gender = p6.Gender;
 | 
						|
            result.SignUpStatus = p6.SignUpStatus;
 | 
						|
            result.Id = p6.Id;
 | 
						|
            return result;
 | 
						|
            
 | 
						|
        }
 | 
						|
        public static Expression<Func<ApplicationUser, ApplicationUserSDto>> 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,
 | 
						|
            BirthDate = p8.BirthDate,
 | 
						|
            Gender = p8.Gender,
 | 
						|
            SignUpStatus = p8.SignUpStatus,
 | 
						|
            Id = p8.Id
 | 
						|
        };
 | 
						|
    }
 | 
						|
} |