Api/Brizco.Domain/Mappers/ShiftMapper.g.cs

178 lines
5.2 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using Brizco.Domain.Dtos.SmallDtos;
using Brizco.Domain.Entities.Shift;
namespace Brizco.Domain.Mappers
{
public static partial class ShiftMapper
{
public static Shift AdaptToShift(this ShiftSDto p1)
{
return p1 == null ? null : new Shift()
{
Title = p1.Title,
StartAt = p1.StartAt,
EndAt = p1.EndAt,
Description = p1.Description,
Days = funcMain1(p1.Days),
Id = p1.Id
};
}
public static Shift AdaptTo(this ShiftSDto p3, Shift p4)
{
if (p3 == null)
{
return null;
}
Shift result = p4 ?? new Shift();
result.Title = p3.Title;
result.StartAt = p3.StartAt;
result.EndAt = p3.EndAt;
result.Description = p3.Description;
result.Days = funcMain2(p3.Days, result.Days);
result.Id = p3.Id;
return result;
}
public static Expression<Func<ShiftSDto, Shift>> ProjectToShift => p7 => new Shift()
{
Title = p7.Title,
StartAt = p7.StartAt,
EndAt = p7.EndAt,
Description = p7.Description,
Days = p7.Days.Select<DayOfWeek, ShiftDay>(p8 => new ShiftDay() {}).ToList<ShiftDay>(),
Id = p7.Id
};
public static ShiftSDto AdaptToSDto(this Shift p9)
{
return p9 == null ? null : new ShiftSDto()
{
Title = p9.Title,
Description = p9.Description,
StartAt = p9.StartAt,
EndAt = p9.EndAt,
Days = funcMain3(p9.Days != null ? p9.Days.Select<ShiftDay, DayOfWeek>(funcMain4).ToList<DayOfWeek>() : new List<DayOfWeek>()),
Id = p9.Id
};
}
public static ShiftSDto AdaptTo(this Shift p11, ShiftSDto p12)
{
if (p11 == null)
{
return null;
}
ShiftSDto result = p12 ?? new ShiftSDto();
result.Title = p11.Title;
result.Description = p11.Description;
result.StartAt = p11.StartAt;
result.EndAt = p11.EndAt;
result.Days = funcMain5(p11.Days != null ? p11.Days.Select<ShiftDay, DayOfWeek>(funcMain4).ToList<DayOfWeek>() : new List<DayOfWeek>(), result.Days);
result.Id = p11.Id;
return result;
}
public static Expression<Func<Shift, ShiftSDto>> ProjectToSDto => p15 => new ShiftSDto()
{
Title = p15.Title,
Description = p15.Description,
StartAt = p15.StartAt,
EndAt = p15.EndAt,
Days = p15.Days != null ? p15.Days.Select<ShiftDay, DayOfWeek>(d => d.DayOfWeek).ToList<DayOfWeek>() : new List<DayOfWeek>(),
Id = p15.Id
};
private static List<ShiftDay> funcMain1(List<DayOfWeek> p2)
{
if (p2 == null)
{
return null;
}
List<ShiftDay> result = new List<ShiftDay>(p2.Count);
int i = 0;
int len = p2.Count;
while (i < len)
{
DayOfWeek item = p2[i];
result.Add(new ShiftDay() {});
i++;
}
return result;
}
private static List<ShiftDay> funcMain2(List<DayOfWeek> p5, List<ShiftDay> p6)
{
if (p5 == null)
{
return null;
}
List<ShiftDay> result = new List<ShiftDay>(p5.Count);
int i = 0;
int len = p5.Count;
while (i < len)
{
DayOfWeek item = p5[i];
result.Add(new ShiftDay() {});
i++;
}
return result;
}
private static List<DayOfWeek> funcMain3(List<DayOfWeek> p10)
{
if (p10 == null)
{
return null;
}
List<DayOfWeek> result = new List<DayOfWeek>(p10.Count);
int i = 0;
int len = p10.Count;
while (i < len)
{
DayOfWeek item = p10[i];
result.Add(item);
i++;
}
return result;
}
private static DayOfWeek funcMain4(ShiftDay d)
{
return d.DayOfWeek;
}
private static List<DayOfWeek> funcMain5(List<DayOfWeek> p13, List<DayOfWeek> p14)
{
if (p13 == null)
{
return null;
}
List<DayOfWeek> result = new List<DayOfWeek>(p13.Count);
int i = 0;
int len = p13.Count;
while (i < len)
{
DayOfWeek item = p13[i];
result.Add(item);
i++;
}
return result;
}
}
}