44 lines
1.3 KiB
C#
44 lines
1.3 KiB
C#
using System;
|
|
using System.Linq.Expressions;
|
|
using NetinaShop.Domain.Dtos.SmallDtos;
|
|
using NetinaShop.Domain.Entities.Warehouses;
|
|
|
|
namespace NetinaShop.Domain.Mappers
|
|
{
|
|
public static partial class ShippingMapper
|
|
{
|
|
public static Shipping AdaptToShipping(this ShippingSDto p1)
|
|
{
|
|
return p1 == null ? null : new Shipping() {Id = p1.Id};
|
|
}
|
|
public static Shipping AdaptTo(this ShippingSDto p2, Shipping p3)
|
|
{
|
|
if (p2 == null)
|
|
{
|
|
return null;
|
|
}
|
|
Shipping result = p3 ?? new Shipping();
|
|
|
|
result.Id = p2.Id;
|
|
return result;
|
|
|
|
}
|
|
public static ShippingSDto AdaptToSDto(this Shipping p4)
|
|
{
|
|
return p4 == null ? null : new ShippingSDto() {Id = p4.Id};
|
|
}
|
|
public static ShippingSDto AdaptTo(this Shipping p5, ShippingSDto p6)
|
|
{
|
|
if (p5 == null)
|
|
{
|
|
return null;
|
|
}
|
|
ShippingSDto result = p6 ?? new ShippingSDto();
|
|
|
|
result.Id = p5.Id;
|
|
return result;
|
|
|
|
}
|
|
public static Expression<Func<Shipping, ShippingSDto>> ProjectToSDto => p7 => new ShippingSDto() {Id = p7.Id};
|
|
}
|
|
} |