Files
components/LiteCharms.Extensions/EntityModeMappers.cs
T
2026-05-03 16:10:27 +02:00

95 lines
2.9 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,
GoogleClickId = entity.GoogleClickId,
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
};
}