using System; using System.Linq.Expressions; using Brizco.Domain.Dtos.LargDtos; using Brizco.Domain.Dtos.SmallDtos; using Brizco.Domain.Entities.Task; namespace Brizco.Domain.Mappers { public static partial class ActivityMapper { public static Activity AdaptToActivity(this ActivitySDto p1) { return p1 == null ? null : new Activity() { Status = p1.Status, DoneAt = p1.DoneAt, IsDone = p1.IsDone, PerformanceDescription = p1.PerformanceDescription, Id = p1.Id }; } public static Activity AdaptTo(this ActivitySDto p2, Activity p3) { if (p2 == null) { return null; } Activity result = p3 ?? new Activity(); result.Status = p2.Status; result.DoneAt = p2.DoneAt; result.IsDone = p2.IsDone; result.PerformanceDescription = p2.PerformanceDescription; result.Id = p2.Id; return result; } public static Expression> ProjectToActivity => p4 => new Activity() { Status = p4.Status, DoneAt = p4.DoneAt, IsDone = p4.IsDone, PerformanceDescription = p4.PerformanceDescription, Id = p4.Id }; public static ActivitySDto AdaptToSDto(this Activity p5) { return p5 == null ? null : new ActivitySDto() { Type = p5.Type, Title = p5.Title, Description = p5.Description, IsRelatedToShift = p5.IsRelatedToShift, IsRelatedToRole = p5.IsRelatedToRole, IsRelatedToPerson = p5.IsRelatedToPerson, IsDisposable = p5.IsDisposable, SetFor = p5.SetFor, HasDisposed = p5.HasDisposed, Status = p5.Status, DoneAt = p5.DoneAt, IsDone = p5.IsDone, PerformanceDescription = p5.PerformanceDescription, Amount = p5.Amount, AmountType = p5.AmountType, Id = p5.Id }; } public static ActivitySDto AdaptTo(this Activity p6, ActivitySDto p7) { if (p6 == null) { return null; } ActivitySDto result = p7 ?? new ActivitySDto(); result.Type = p6.Type; result.Title = p6.Title; result.Description = p6.Description; result.IsRelatedToShift = p6.IsRelatedToShift; result.IsRelatedToRole = p6.IsRelatedToRole; result.IsRelatedToPerson = p6.IsRelatedToPerson; result.IsDisposable = p6.IsDisposable; result.SetFor = p6.SetFor; result.HasDisposed = p6.HasDisposed; result.Status = p6.Status; result.DoneAt = p6.DoneAt; result.IsDone = p6.IsDone; result.PerformanceDescription = p6.PerformanceDescription; result.Amount = p6.Amount; result.AmountType = p6.AmountType; result.Id = p6.Id; return result; } public static Expression> ProjectToSDto => p8 => new ActivitySDto() { Type = p8.Type, Title = p8.Title, Description = p8.Description, IsRelatedToShift = p8.IsRelatedToShift, IsRelatedToRole = p8.IsRelatedToRole, IsRelatedToPerson = p8.IsRelatedToPerson, IsDisposable = p8.IsDisposable, SetFor = p8.SetFor, HasDisposed = p8.HasDisposed, Status = p8.Status, DoneAt = p8.DoneAt, IsDone = p8.IsDone, PerformanceDescription = p8.PerformanceDescription, Amount = p8.Amount, AmountType = p8.AmountType, Id = p8.Id }; public static Activity AdaptToActivity(this ActivityLDto p9) { return p9 == null ? null : new Activity() { Status = p9.Status, DoneAt = p9.DoneAt, IsDone = p9.IsDone, PerformanceDescription = p9.PerformanceDescription, Id = p9.Id }; } public static Activity AdaptTo(this ActivityLDto p10, Activity p11) { if (p10 == null) { return null; } Activity result = p11 ?? new Activity(); result.Status = p10.Status; result.DoneAt = p10.DoneAt; result.IsDone = p10.IsDone; result.PerformanceDescription = p10.PerformanceDescription; result.Id = p10.Id; return result; } public static Expression> ProjectLDtoToActivity => p12 => new Activity() { Status = p12.Status, DoneAt = p12.DoneAt, IsDone = p12.IsDone, PerformanceDescription = p12.PerformanceDescription, Id = p12.Id }; public static ActivityLDto AdaptToLDto(this Activity p13) { return p13 == null ? null : new ActivityLDto() { Type = p13.Type, Title = p13.Title, Description = p13.Description, IsRelatedToShift = p13.IsRelatedToShift, IsRelatedToRole = p13.IsRelatedToRole, IsRelatedToPerson = p13.IsRelatedToPerson, IsDisposable = p13.IsDisposable, SetFor = p13.SetFor, HasDisposed = p13.HasDisposed, Status = p13.Status, DoneAt = p13.DoneAt, IsDone = p13.IsDone, PerformanceDescription = p13.PerformanceDescription, Amount = p13.Amount, AmountType = p13.AmountType, Id = p13.Id }; } public static ActivityLDto AdaptTo(this Activity p14, ActivityLDto p15) { if (p14 == null) { return null; } ActivityLDto result = p15 ?? new ActivityLDto(); result.Type = p14.Type; result.Title = p14.Title; result.Description = p14.Description; result.IsRelatedToShift = p14.IsRelatedToShift; result.IsRelatedToRole = p14.IsRelatedToRole; result.IsRelatedToPerson = p14.IsRelatedToPerson; result.IsDisposable = p14.IsDisposable; result.SetFor = p14.SetFor; result.HasDisposed = p14.HasDisposed; result.Status = p14.Status; result.DoneAt = p14.DoneAt; result.IsDone = p14.IsDone; result.PerformanceDescription = p14.PerformanceDescription; result.Amount = p14.Amount; result.AmountType = p14.AmountType; result.Id = p14.Id; return result; } public static Expression> ProjectToLDto => p16 => new ActivityLDto() { Type = p16.Type, Title = p16.Title, Description = p16.Description, IsRelatedToShift = p16.IsRelatedToShift, IsRelatedToRole = p16.IsRelatedToRole, IsRelatedToPerson = p16.IsRelatedToPerson, IsDisposable = p16.IsDisposable, SetFor = p16.SetFor, HasDisposed = p16.HasDisposed, Status = p16.Status, DoneAt = p16.DoneAt, IsDone = p16.IsDone, PerformanceDescription = p16.PerformanceDescription, Amount = p16.Amount, AmountType = p16.AmountType, Id = p16.Id }; } }