75 lines
2.1 KiB
C#
75 lines
2.1 KiB
C#
using System;
|
|
using System.Linq.Expressions;
|
|
using DocuMed.Domain.Dtos.SmallDtos;
|
|
using DocuMed.Domain.Entities.Hospitals;
|
|
|
|
namespace DocuMed.Domain.Mappers
|
|
{
|
|
public static partial class SectionMapper
|
|
{
|
|
public static Section AdaptToSection(this SectionSDto p1)
|
|
{
|
|
return p1 == null ? null : new Section()
|
|
{
|
|
Name = p1.Name,
|
|
Detail = p1.Detail,
|
|
HospitalId = p1.HospitalId,
|
|
Id = p1.Id
|
|
};
|
|
}
|
|
public static Section AdaptTo(this SectionSDto p2, Section p3)
|
|
{
|
|
if (p2 == null)
|
|
{
|
|
return null;
|
|
}
|
|
Section result = p3 ?? new Section();
|
|
|
|
result.Name = p2.Name;
|
|
result.Detail = p2.Detail;
|
|
result.HospitalId = p2.HospitalId;
|
|
result.Id = p2.Id;
|
|
return result;
|
|
|
|
}
|
|
public static Expression<Func<SectionSDto, Section>> ProjectToSection => p4 => new Section()
|
|
{
|
|
Name = p4.Name,
|
|
Detail = p4.Detail,
|
|
HospitalId = p4.HospitalId,
|
|
Id = p4.Id
|
|
};
|
|
public static SectionSDto AdaptToSDto(this Section p5)
|
|
{
|
|
return p5 == null ? null : new SectionSDto()
|
|
{
|
|
Name = p5.Name,
|
|
Detail = p5.Detail,
|
|
HospitalId = p5.HospitalId,
|
|
Id = p5.Id
|
|
};
|
|
}
|
|
public static SectionSDto AdaptTo(this Section p6, SectionSDto p7)
|
|
{
|
|
if (p6 == null)
|
|
{
|
|
return null;
|
|
}
|
|
SectionSDto result = p7 ?? new SectionSDto();
|
|
|
|
result.Name = p6.Name;
|
|
result.Detail = p6.Detail;
|
|
result.HospitalId = p6.HospitalId;
|
|
result.Id = p6.Id;
|
|
return result;
|
|
|
|
}
|
|
public static Expression<Func<Section, SectionSDto>> ProjectToSDto => p8 => new SectionSDto()
|
|
{
|
|
Name = p8.Name,
|
|
Detail = p8.Detail,
|
|
HospitalId = p8.HospitalId,
|
|
Id = p8.Id
|
|
};
|
|
}
|
|
} |