140 lines
4.2 KiB
C#
140 lines
4.2 KiB
C#
using System;
|
|
using System.Linq.Expressions;
|
|
using Brizco.Domain.Dtos.LargDtos;
|
|
using Brizco.Domain.Dtos.SmallDtos;
|
|
using Brizco.Domain.Entities.Complex;
|
|
|
|
namespace Brizco.Domain.Mappers
|
|
{
|
|
public static partial class ComplexMapper
|
|
{
|
|
public static Complex AdaptToComplex(this ComplexSDto p1)
|
|
{
|
|
return p1 == null ? null : new Complex()
|
|
{
|
|
Name = p1.Name,
|
|
Address = p1.Address,
|
|
SupportPhone = p1.SupportPhone,
|
|
Id = p1.Id
|
|
};
|
|
}
|
|
public static Complex AdaptTo(this ComplexSDto p2, Complex p3)
|
|
{
|
|
if (p2 == null)
|
|
{
|
|
return null;
|
|
}
|
|
Complex result = p3 ?? new Complex();
|
|
|
|
result.Name = p2.Name;
|
|
result.Address = p2.Address;
|
|
result.SupportPhone = p2.SupportPhone;
|
|
result.Id = p2.Id;
|
|
return result;
|
|
|
|
}
|
|
public static Expression<Func<ComplexSDto, Complex>> ProjectToComplex => p4 => new Complex()
|
|
{
|
|
Name = p4.Name,
|
|
Address = p4.Address,
|
|
SupportPhone = p4.SupportPhone,
|
|
Id = p4.Id
|
|
};
|
|
public static ComplexSDto AdaptToSDto(this Complex p5)
|
|
{
|
|
return p5 == null ? null : new ComplexSDto()
|
|
{
|
|
Name = p5.Name,
|
|
Address = p5.Address,
|
|
SupportPhone = p5.SupportPhone,
|
|
Id = p5.Id
|
|
};
|
|
}
|
|
public static ComplexSDto AdaptTo(this Complex p6, ComplexSDto p7)
|
|
{
|
|
if (p6 == null)
|
|
{
|
|
return null;
|
|
}
|
|
ComplexSDto result = p7 ?? new ComplexSDto();
|
|
|
|
result.Name = p6.Name;
|
|
result.Address = p6.Address;
|
|
result.SupportPhone = p6.SupportPhone;
|
|
result.Id = p6.Id;
|
|
return result;
|
|
|
|
}
|
|
public static Expression<Func<Complex, ComplexSDto>> ProjectToSDto => p8 => new ComplexSDto()
|
|
{
|
|
Name = p8.Name,
|
|
Address = p8.Address,
|
|
SupportPhone = p8.SupportPhone,
|
|
Id = p8.Id
|
|
};
|
|
public static Complex AdaptToComplex(this ComplexLDto p9)
|
|
{
|
|
return p9 == null ? null : new Complex()
|
|
{
|
|
Name = p9.Name,
|
|
Address = p9.Address,
|
|
SupportPhone = p9.SupportPhone,
|
|
Id = p9.Id
|
|
};
|
|
}
|
|
public static Complex AdaptTo(this ComplexLDto p10, Complex p11)
|
|
{
|
|
if (p10 == null)
|
|
{
|
|
return null;
|
|
}
|
|
Complex result = p11 ?? new Complex();
|
|
|
|
result.Name = p10.Name;
|
|
result.Address = p10.Address;
|
|
result.SupportPhone = p10.SupportPhone;
|
|
result.Id = p10.Id;
|
|
return result;
|
|
|
|
}
|
|
public static Expression<Func<ComplexLDto, Complex>> ProjectLDtoToComplex => p12 => new Complex()
|
|
{
|
|
Name = p12.Name,
|
|
Address = p12.Address,
|
|
SupportPhone = p12.SupportPhone,
|
|
Id = p12.Id
|
|
};
|
|
public static ComplexLDto AdaptToLDto(this Complex p13)
|
|
{
|
|
return p13 == null ? null : new ComplexLDto()
|
|
{
|
|
Name = p13.Name,
|
|
Address = p13.Address,
|
|
SupportPhone = p13.SupportPhone,
|
|
Id = p13.Id
|
|
};
|
|
}
|
|
public static ComplexLDto AdaptTo(this Complex p14, ComplexLDto p15)
|
|
{
|
|
if (p14 == null)
|
|
{
|
|
return null;
|
|
}
|
|
ComplexLDto result = p15 ?? new ComplexLDto();
|
|
|
|
result.Name = p14.Name;
|
|
result.Address = p14.Address;
|
|
result.SupportPhone = p14.SupportPhone;
|
|
result.Id = p14.Id;
|
|
return result;
|
|
|
|
}
|
|
public static Expression<Func<Complex, ComplexLDto>> ProjectToLDto => p16 => new ComplexLDto()
|
|
{
|
|
Name = p16.Name,
|
|
Address = p16.Address,
|
|
SupportPhone = p16.SupportPhone,
|
|
Id = p16.Id
|
|
};
|
|
}
|
|
} |