Api-PWA/DocuMed.Domain/Mappers/UniversityMapper.g.cs

75 lines
2.2 KiB
C#

using System;
using System.Linq.Expressions;
using DocuMed.Domain.Dtos.SmallDtos;
using DocuMed.Domain.Entities.City;
namespace DocuMed.Domain.Mappers
{
public static partial class UniversityMapper
{
public static University AdaptToUniversity(this UniversitySDto p1)
{
return p1 == null ? null : new University()
{
Name = p1.Name,
Address = p1.Address,
CityId = p1.CityId,
Id = p1.Id
};
}
public static University AdaptTo(this UniversitySDto p2, University p3)
{
if (p2 == null)
{
return null;
}
University result = p3 ?? new University();
result.Name = p2.Name;
result.Address = p2.Address;
result.CityId = p2.CityId;
result.Id = p2.Id;
return result;
}
public static Expression<Func<UniversitySDto, University>> ProjectToUniversity => p4 => new University()
{
Name = p4.Name,
Address = p4.Address,
CityId = p4.CityId,
Id = p4.Id
};
public static UniversitySDto AdaptToSDto(this University p5)
{
return p5 == null ? null : new UniversitySDto()
{
Name = p5.Name,
Address = p5.Address,
CityId = p5.CityId,
Id = p5.Id
};
}
public static UniversitySDto AdaptTo(this University p6, UniversitySDto p7)
{
if (p6 == null)
{
return null;
}
UniversitySDto result = p7 ?? new UniversitySDto();
result.Name = p6.Name;
result.Address = p6.Address;
result.CityId = p6.CityId;
result.Id = p6.Id;
return result;
}
public static Expression<Func<University, UniversitySDto>> ProjectToSDto => p8 => new UniversitySDto()
{
Name = p8.Name,
Address = p8.Address,
CityId = p8.CityId,
Id = p8.Id
};
}
}