34 lines
1.2 KiB
C#
34 lines
1.2 KiB
C#
using Brizco.Domain.Entities.Complex;
|
|
using Brizco.Domain.Entities.Shift;
|
|
using Mapster;
|
|
|
|
namespace Brizco.Domain;
|
|
|
|
public class MapsterRegister : IRegister
|
|
{
|
|
public void Register(TypeAdapterConfig config)
|
|
{
|
|
config.NewConfig<Shift, ShiftSDto>()
|
|
.Map("Days",o=>o.Days.Select(d=>d.DayOfWeek).ToList())
|
|
.TwoWays();
|
|
|
|
config.NewConfig<Shift, ShiftLDto>()
|
|
.Map("Days", o => o.Days.Select(d => d.DayOfWeek).ToList())
|
|
.TwoWays();
|
|
|
|
config.NewConfig<ComplexUserRole, ComplexUserRoleSDto>()
|
|
.Map("RoleName", org => org.Role!.PersianName)
|
|
.TwoWays();
|
|
|
|
config.NewConfig<Position, PositionLDto>()
|
|
.Map("SectionName", org => org.Section != null ? org.Section.Name : string.Empty)
|
|
.TwoWays();
|
|
|
|
config.NewConfig<ComplexUser, ComplexUserSDto>()
|
|
.Map("ComplexName", o=>o.Complex!=null ? o.Complex.Name : string.Empty)
|
|
.Map("FirstName", o=>o.User!=null ? o.User.FirstName : string.Empty)
|
|
.Map("LastName", o=>o.User!=null ? o.User.LastName : string.Empty)
|
|
.Map("NationalId", o=>o.User!=null ? o.User.NationalId : string.Empty)
|
|
.TwoWays();
|
|
}
|
|
} |