Api/Netina.Domain/Mappers/CommentMapper.g.cs

166 lines
5.5 KiB
C#

using System;
using System.Linq.Expressions;
using Netina.Domain.Dtos.LargDtos;
using Netina.Domain.Dtos.SmallDtos;
using Netina.Domain.Entities.Comments;
namespace Netina.Domain.Mappers
{
public static partial class CommentMapper
{
public static Comment AdaptToComment(this CommentLDto p1)
{
return p1 == null ? null : new Comment()
{
Title = p1.Title,
Rate = p1.Rate,
IsConfirmed = p1.IsConfirmed,
ParentId = (Guid?)p1.ParentId,
UserId = p1.UserId,
Id = p1.Id,
CreatedAt = p1.CreatedAt
};
}
public static Comment AdaptTo(this CommentLDto p2, Comment p3)
{
if (p2 == null)
{
return null;
}
Comment result = p3 ?? new Comment();
result.Title = p2.Title;
result.Rate = p2.Rate;
result.IsConfirmed = p2.IsConfirmed;
result.ParentId = (Guid?)p2.ParentId;
result.UserId = p2.UserId;
result.Id = p2.Id;
result.CreatedAt = p2.CreatedAt;
return result;
}
public static Expression<Func<CommentLDto, Comment>> ProjectToComment => p4 => new Comment()
{
Title = p4.Title,
Rate = p4.Rate,
IsConfirmed = p4.IsConfirmed,
ParentId = (Guid?)p4.ParentId,
UserId = p4.UserId,
Id = p4.Id,
CreatedAt = p4.CreatedAt
};
public static CommentLDto AdaptToLDto(this Comment p5)
{
return p5 == null ? null : new CommentLDto()
{
Title = p5.Title,
Rate = p5.Rate,
IsConfirmed = p5.IsConfirmed,
ParentId = p5.ParentId == null ? default(Guid) : (Guid)p5.ParentId,
UserId = p5.UserId,
Id = p5.Id,
CreatedAt = p5.CreatedAt
};
}
public static CommentLDto AdaptTo(this Comment p6, CommentLDto p7)
{
if (p6 == null)
{
return null;
}
CommentLDto result = p7 ?? new CommentLDto();
result.Title = p6.Title;
result.Rate = p6.Rate;
result.IsConfirmed = p6.IsConfirmed;
result.ParentId = p6.ParentId == null ? default(Guid) : (Guid)p6.ParentId;
result.UserId = p6.UserId;
result.Id = p6.Id;
result.CreatedAt = p6.CreatedAt;
return result;
}
public static Expression<Func<Comment, CommentLDto>> ProjectToLDto => p8 => new CommentLDto()
{
Title = p8.Title,
Rate = p8.Rate,
IsConfirmed = p8.IsConfirmed,
ParentId = p8.ParentId == null ? default(Guid) : (Guid)p8.ParentId,
UserId = p8.UserId,
Id = p8.Id,
CreatedAt = p8.CreatedAt
};
public static Comment AdaptToComment(this CommentSDto p9)
{
return p9 == null ? null : new Comment()
{
Title = p9.Title,
Content = p9.Content,
IsConfirmed = p9.IsConfirmed,
ParentId = (Guid?)p9.ParentId,
UserId = p9.UserId,
Id = p9.Id,
CreatedAt = p9.CreatedAt
};
}
public static Comment AdaptTo(this CommentSDto p10, Comment p11)
{
if (p10 == null)
{
return null;
}
Comment result = p11 ?? new Comment();
result.Title = p10.Title;
result.Content = p10.Content;
result.IsConfirmed = p10.IsConfirmed;
result.ParentId = (Guid?)p10.ParentId;
result.UserId = p10.UserId;
result.Id = p10.Id;
result.CreatedAt = p10.CreatedAt;
return result;
}
public static CommentSDto AdaptToSDto(this Comment p12)
{
return p12 == null ? null : new CommentSDto()
{
Title = p12.Title,
Content = p12.Content,
IsConfirmed = p12.IsConfirmed,
ParentId = p12.ParentId == null ? default(Guid) : (Guid)p12.ParentId,
UserId = p12.UserId,
Id = p12.Id,
CreatedAt = p12.CreatedAt
};
}
public static CommentSDto AdaptTo(this Comment p13, CommentSDto p14)
{
if (p13 == null)
{
return null;
}
CommentSDto result = p14 ?? new CommentSDto();
result.Title = p13.Title;
result.Content = p13.Content;
result.IsConfirmed = p13.IsConfirmed;
result.ParentId = p13.ParentId == null ? default(Guid) : (Guid)p13.ParentId;
result.UserId = p13.UserId;
result.Id = p13.Id;
result.CreatedAt = p13.CreatedAt;
return result;
}
public static Expression<Func<Comment, CommentSDto>> ProjectToSDto => p15 => new CommentSDto()
{
Title = p15.Title,
Content = p15.Content,
IsConfirmed = p15.IsConfirmed,
ParentId = p15.ParentId == null ? default(Guid) : (Guid)p15.ParentId,
UserId = p15.UserId,
Id = p15.Id,
CreatedAt = p15.CreatedAt
};
}
}