96 lines
3.0 KiB
C#
96 lines
3.0 KiB
C#
using LiteCharms.Models;
|
|
|
|
namespace LiteCharms.Extensions;
|
|
|
|
public static class EntityModeMappers
|
|
{
|
|
public static Customer ToModel(this Entities.Customer entity) =>
|
|
new()
|
|
{
|
|
Id = entity.Id,
|
|
CreatedAt = entity.CreatedAt,
|
|
UpdatedAt = entity.UpdatedAt,
|
|
Active = entity.Active,
|
|
Address = entity.Address,
|
|
City = entity.City,
|
|
Company = entity.Company,
|
|
Country = entity.Country,
|
|
Discord = entity.Discord,
|
|
Email = entity.Email,
|
|
LastName = entity.LastName,
|
|
LinkedIn = entity.LinkedIn,
|
|
Name = entity.Name,
|
|
Phone = entity.Phone,
|
|
PostalCode = entity.PostalCode,
|
|
Region = entity.Region,
|
|
Slack = entity.Slack,
|
|
Tax = entity.Tax,
|
|
Website = entity.Website,
|
|
Whatsapp = entity.Whatsapp
|
|
};
|
|
|
|
public static Lead ToModel(this Entities.Lead entity) =>
|
|
new()
|
|
{
|
|
Id = entity.Id,
|
|
CreatedAt = entity.CreatedAt,
|
|
UpdatedAt = entity.UpdatedAt,
|
|
AdGroupId = entity.AdGroupId,
|
|
AdName = entity.AdName,
|
|
AppClickId = entity.AppClickId,
|
|
AttributionHash = entity.AttributionHash,
|
|
CampaignId = entity.CampaignId,
|
|
ClickLocation = entity.ClickLocation,
|
|
CustomerId = entity.CustomerId,
|
|
FeedItemId = entity.FeedItemId,
|
|
Source = entity.Source,
|
|
ClickId = entity.ClickId,
|
|
TargetId = entity.TargetId,
|
|
WebClickId = entity.WebClickId,
|
|
Status = entity.Status
|
|
};
|
|
|
|
public static Order ToModel(this Entities.Order entity) =>
|
|
new()
|
|
{
|
|
Id = entity.Id,
|
|
CreatedAt = entity.CreatedAt,
|
|
UpdatedAt = entity.UpdatedAt,
|
|
CustomerId = entity.CustomerId,
|
|
ProductPriceId = entity.ProductPriceId,
|
|
Notes = entity.Notes,
|
|
RefundId = entity.RefundId
|
|
};
|
|
|
|
public static OrderRefund ToModel(this Entities.OrderRefund entity) =>
|
|
new()
|
|
{
|
|
Id = entity.Id,
|
|
CreatedAt = entity.CreatedAt,
|
|
OrderId = entity.OrderId,
|
|
Reason = entity.Reason,
|
|
Amount = entity.Amount
|
|
};
|
|
|
|
public static Product ToModel(this Entities.Product entity) =>
|
|
new()
|
|
{
|
|
Id = entity.Id,
|
|
Name = entity.Name,
|
|
Description = entity.Description,
|
|
Active = entity.Active
|
|
};
|
|
|
|
public static ProductPrice ToModel(this Entities.ProductPrice entity) =>
|
|
new()
|
|
{
|
|
Id = entity.Id,
|
|
ProductId = entity.ProductId,
|
|
Price = entity.Price,
|
|
Active = entity.Active,
|
|
CreatedAt = entity.CreatedAt,
|
|
Discount = entity.Discount,
|
|
UpdatedAt = entity.UpdatedAt
|
|
};
|
|
}
|