838 lines
30 KiB
C#
838 lines
30 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Linq.Expressions;
|
|
using Mapster.Models;
|
|
using Netina.Domain.Dtos.LargDtos;
|
|
using Netina.Domain.Dtos.ResponseDtos.Torob;
|
|
using Netina.Domain.Dtos.SmallDtos;
|
|
using Netina.Domain.Entities.Brands;
|
|
using Netina.Domain.Entities.ProductCategories;
|
|
using Netina.Domain.Entities.Products;
|
|
using Review = Netina.Domain.Entities.Reviews.Review;
|
|
|
|
namespace Netina.Domain.Mappers
|
|
{
|
|
public static partial class ProductMapper
|
|
{
|
|
public static Product AdaptToProduct(this ProductLDto p1)
|
|
{
|
|
return p1 == null ? null : new Product()
|
|
{
|
|
PersianName = p1.PersianName,
|
|
EnglishName = p1.EnglishName,
|
|
Slug = p1.Slug,
|
|
Summery = p1.Summery,
|
|
ExpertCheck = p1.ExpertCheck,
|
|
Tags = p1.Tags,
|
|
Warranty = p1.Warranty,
|
|
Cost = p1.Cost,
|
|
BeDisplayed = p1.BeDisplayed,
|
|
PackingCost = p1.PackingCost,
|
|
Stock = p1.Stock,
|
|
HasExpressDelivery = p1.HasExpressDelivery,
|
|
MaxOrderCount = p1.MaxOrderCount,
|
|
BrandId = p1.BrandId,
|
|
Brand = new Brand() {Id = p1.BrandId},
|
|
CategoryId = p1.CategoryId,
|
|
Category = new ProductCategory()
|
|
{
|
|
Name = p1.CategoryName,
|
|
Id = p1.CategoryId
|
|
},
|
|
Specifications = funcMain1(p1.Specifications),
|
|
Reviews = funcMain2(p1.Reviews),
|
|
Files = funcMain3(p1.Files),
|
|
Id = p1.Id,
|
|
CreatedAt = p1.CreatedAt
|
|
};
|
|
}
|
|
public static Product AdaptTo(this ProductLDto p5, Product p6)
|
|
{
|
|
if (p5 == null)
|
|
{
|
|
return null;
|
|
}
|
|
Product result = p6 ?? new Product();
|
|
|
|
result.PersianName = p5.PersianName;
|
|
result.EnglishName = p5.EnglishName;
|
|
result.Slug = p5.Slug;
|
|
result.Summery = p5.Summery;
|
|
result.ExpertCheck = p5.ExpertCheck;
|
|
result.Tags = p5.Tags;
|
|
result.Warranty = p5.Warranty;
|
|
result.Cost = p5.Cost;
|
|
result.BeDisplayed = p5.BeDisplayed;
|
|
result.PackingCost = p5.PackingCost;
|
|
result.Stock = p5.Stock;
|
|
result.HasExpressDelivery = p5.HasExpressDelivery;
|
|
result.MaxOrderCount = p5.MaxOrderCount;
|
|
result.BrandId = p5.BrandId;
|
|
result.Brand = funcMain4(new Never(), result.Brand, p5);
|
|
result.CategoryId = p5.CategoryId;
|
|
result.Category = funcMain5(new Never(), result.Category, p5);
|
|
result.Specifications = funcMain6(p5.Specifications, result.Specifications);
|
|
result.Reviews = funcMain7(p5.Reviews, result.Reviews);
|
|
result.Files = funcMain8(p5.Files, result.Files);
|
|
result.Id = p5.Id;
|
|
result.CreatedAt = p5.CreatedAt;
|
|
return result;
|
|
|
|
}
|
|
public static Expression<Func<ProductLDto, Product>> ProjectToProduct => p17 => new Product()
|
|
{
|
|
PersianName = p17.PersianName,
|
|
EnglishName = p17.EnglishName,
|
|
Slug = p17.Slug,
|
|
Summery = p17.Summery,
|
|
ExpertCheck = p17.ExpertCheck,
|
|
Tags = p17.Tags,
|
|
Warranty = p17.Warranty,
|
|
Cost = p17.Cost,
|
|
BeDisplayed = p17.BeDisplayed,
|
|
PackingCost = p17.PackingCost,
|
|
Stock = p17.Stock,
|
|
HasExpressDelivery = p17.HasExpressDelivery,
|
|
MaxOrderCount = p17.MaxOrderCount,
|
|
BrandId = p17.BrandId,
|
|
Brand = new Brand() {Id = p17.BrandId},
|
|
CategoryId = p17.CategoryId,
|
|
Category = new ProductCategory()
|
|
{
|
|
Name = p17.CategoryName,
|
|
Id = p17.CategoryId
|
|
},
|
|
Specifications = p17.Specifications.Select<SpecificationSDto, Specification>(p18 => new Specification()
|
|
{
|
|
Title = p18.Title,
|
|
Detail = p18.Detail,
|
|
Value = p18.Value,
|
|
IsFeature = p18.IsFeature,
|
|
ProductId = p18.ProductId,
|
|
ParentId = (Guid?)p18.ParentId,
|
|
Id = p18.Id,
|
|
CreatedAt = p18.CreatedAt
|
|
}).ToList<Specification>(),
|
|
Reviews = p17.Reviews.Select<ReviewSDto, Review>(p19 => new Review()
|
|
{
|
|
Title = p19.Title,
|
|
Comment = p19.Comment,
|
|
Rate = p19.Rate,
|
|
IsBuyer = p19.IsBuyer,
|
|
ProductId = p19.ProductId,
|
|
UserId = p19.UserId,
|
|
Id = p19.Id,
|
|
CreatedAt = p19.CreatedAt
|
|
}).ToList<Review>(),
|
|
Files = p17.Files.Select<StorageFileSDto, ProductStorageFile>(p20 => new ProductStorageFile()
|
|
{
|
|
Name = p20.Name,
|
|
FileLocation = p20.FileLocation,
|
|
FileName = p20.FileName,
|
|
IsHeader = p20.IsHeader,
|
|
IsPrimary = p20.IsPrimary,
|
|
FileType = p20.FileType,
|
|
Id = p20.Id,
|
|
CreatedAt = p20.CreatedAt
|
|
}).ToList<ProductStorageFile>(),
|
|
Id = p17.Id,
|
|
CreatedAt = p17.CreatedAt
|
|
};
|
|
public static ProductLDto AdaptToLDto(this Product p21)
|
|
{
|
|
return p21 == null ? null : new ProductLDto()
|
|
{
|
|
PersianName = p21.PersianName,
|
|
EnglishName = p21.EnglishName,
|
|
Summery = p21.Summery,
|
|
ExpertCheck = p21.ExpertCheck,
|
|
Tags = p21.Tags,
|
|
Slug = p21.Slug,
|
|
Warranty = p21.Warranty,
|
|
BeDisplayed = p21.BeDisplayed,
|
|
HasExpressDelivery = p21.HasExpressDelivery,
|
|
Cost = p21.Cost,
|
|
PackingCost = p21.PackingCost,
|
|
MaxOrderCount = p21.MaxOrderCount,
|
|
Stock = p21.Stock,
|
|
BrandId = p21.BrandId,
|
|
BrandName = p21.Brand == null ? null : p21.Brand.PersianName,
|
|
CategoryId = p21.CategoryId,
|
|
CategoryName = p21.Category == null ? null : p21.Category.Name,
|
|
Specifications = funcMain9(p21.Specifications),
|
|
Reviews = funcMain10(p21.Reviews),
|
|
Files = funcMain11(p21.Files),
|
|
Id = p21.Id,
|
|
CreatedAt = p21.CreatedAt
|
|
};
|
|
}
|
|
public static ProductLDto AdaptTo(this Product p25, ProductLDto p26)
|
|
{
|
|
if (p25 == null)
|
|
{
|
|
return null;
|
|
}
|
|
ProductLDto result = p26 ?? new ProductLDto();
|
|
|
|
result.PersianName = p25.PersianName;
|
|
result.EnglishName = p25.EnglishName;
|
|
result.Summery = p25.Summery;
|
|
result.ExpertCheck = p25.ExpertCheck;
|
|
result.Tags = p25.Tags;
|
|
result.Slug = p25.Slug;
|
|
result.Warranty = p25.Warranty;
|
|
result.BeDisplayed = p25.BeDisplayed;
|
|
result.HasExpressDelivery = p25.HasExpressDelivery;
|
|
result.Cost = p25.Cost;
|
|
result.PackingCost = p25.PackingCost;
|
|
result.MaxOrderCount = p25.MaxOrderCount;
|
|
result.Stock = p25.Stock;
|
|
result.BrandId = p25.BrandId;
|
|
result.BrandName = p25.Brand == null ? null : p25.Brand.PersianName;
|
|
result.CategoryId = p25.CategoryId;
|
|
result.CategoryName = p25.Category == null ? null : p25.Category.Name;
|
|
result.Specifications = funcMain12(p25.Specifications, result.Specifications);
|
|
result.Reviews = funcMain13(p25.Reviews, result.Reviews);
|
|
result.Files = funcMain14(p25.Files, result.Files);
|
|
result.Id = p25.Id;
|
|
result.CreatedAt = p25.CreatedAt;
|
|
return result;
|
|
|
|
}
|
|
public static Expression<Func<Product, ProductLDto>> ProjectToLDto => p33 => new ProductLDto()
|
|
{
|
|
PersianName = p33.PersianName,
|
|
EnglishName = p33.EnglishName,
|
|
Summery = p33.Summery,
|
|
ExpertCheck = p33.ExpertCheck,
|
|
Tags = p33.Tags,
|
|
Slug = p33.Slug,
|
|
Warranty = p33.Warranty,
|
|
BeDisplayed = p33.BeDisplayed,
|
|
HasExpressDelivery = p33.HasExpressDelivery,
|
|
Cost = p33.Cost,
|
|
PackingCost = p33.PackingCost,
|
|
MaxOrderCount = p33.MaxOrderCount,
|
|
Stock = p33.Stock,
|
|
BrandId = p33.BrandId,
|
|
BrandName = p33.Brand == null ? null : p33.Brand.PersianName,
|
|
CategoryId = p33.CategoryId,
|
|
CategoryName = p33.Category == null ? null : p33.Category.Name,
|
|
Specifications = p33.Specifications.Select<Specification, SpecificationSDto>(p34 => new SpecificationSDto()
|
|
{
|
|
Title = p34.Title,
|
|
Detail = p34.Detail,
|
|
Value = p34.Value,
|
|
IsFeature = p34.IsFeature,
|
|
ProductId = p34.ProductId,
|
|
ParentId = p34.ParentId == null ? default(Guid) : (Guid)p34.ParentId,
|
|
Id = p34.Id,
|
|
CreatedAt = p34.CreatedAt
|
|
}).ToList<SpecificationSDto>(),
|
|
Reviews = p33.Reviews.Select<Review, ReviewSDto>(p35 => new ReviewSDto()
|
|
{
|
|
Title = p35.Title,
|
|
Comment = p35.Comment,
|
|
Rate = p35.Rate,
|
|
IsBuyer = p35.IsBuyer,
|
|
ProductId = p35.ProductId,
|
|
UserId = p35.UserId,
|
|
Id = p35.Id,
|
|
CreatedAt = p35.CreatedAt
|
|
}).ToList<ReviewSDto>(),
|
|
Files = p33.Files.Select<ProductStorageFile, StorageFileSDto>(p36 => new StorageFileSDto()
|
|
{
|
|
Name = p36.Name,
|
|
FileLocation = p36.FileLocation,
|
|
FileName = p36.FileName,
|
|
IsHeader = p36.IsHeader,
|
|
IsPrimary = p36.IsPrimary,
|
|
FileType = p36.FileType,
|
|
Id = p36.Id
|
|
}).ToList<StorageFileSDto>(),
|
|
Id = p33.Id,
|
|
CreatedAt = p33.CreatedAt
|
|
};
|
|
public static Product AdaptToProduct(this ProductSDto p37)
|
|
{
|
|
return p37 == null ? null : new Product()
|
|
{
|
|
PersianName = p37.PersianName,
|
|
EnglishName = p37.EnglishName,
|
|
Slug = p37.Slug,
|
|
Summery = p37.Summery,
|
|
ExpertCheck = p37.ExpertCheck,
|
|
Tags = p37.Tags,
|
|
Warranty = p37.Warranty,
|
|
Cost = p37.Cost,
|
|
IsEnable = p37.IsEnable,
|
|
BeDisplayed = p37.BeDisplayed,
|
|
PackingCost = p37.PackingCost,
|
|
Stock = p37.Stock,
|
|
Rate = p37.Rate,
|
|
ReviewCount = p37.ReviewCount,
|
|
Viewed = p37.Viewed,
|
|
MaxOrderCount = p37.MaxOrderCount,
|
|
BrandId = p37.BrandId,
|
|
Brand = new Brand() {Id = p37.BrandId},
|
|
CategoryId = p37.CategoryId,
|
|
Category = new ProductCategory()
|
|
{
|
|
Name = p37.CategoryName,
|
|
Id = p37.CategoryId
|
|
},
|
|
Id = p37.Id,
|
|
CreatedAt = p37.CreatedAt,
|
|
ModifiedAt = p37.ModifiedAt
|
|
};
|
|
}
|
|
public static Product AdaptTo(this ProductSDto p38, Product p39)
|
|
{
|
|
if (p38 == null)
|
|
{
|
|
return null;
|
|
}
|
|
Product result = p39 ?? new Product();
|
|
|
|
result.PersianName = p38.PersianName;
|
|
result.EnglishName = p38.EnglishName;
|
|
result.Slug = p38.Slug;
|
|
result.Summery = p38.Summery;
|
|
result.ExpertCheck = p38.ExpertCheck;
|
|
result.Tags = p38.Tags;
|
|
result.Warranty = p38.Warranty;
|
|
result.Cost = p38.Cost;
|
|
result.IsEnable = p38.IsEnable;
|
|
result.BeDisplayed = p38.BeDisplayed;
|
|
result.PackingCost = p38.PackingCost;
|
|
result.Stock = p38.Stock;
|
|
result.Rate = p38.Rate;
|
|
result.ReviewCount = p38.ReviewCount;
|
|
result.Viewed = p38.Viewed;
|
|
result.MaxOrderCount = p38.MaxOrderCount;
|
|
result.BrandId = p38.BrandId;
|
|
result.Brand = funcMain15(new Never(), result.Brand, p38);
|
|
result.CategoryId = p38.CategoryId;
|
|
result.Category = funcMain16(new Never(), result.Category, p38);
|
|
result.Id = p38.Id;
|
|
result.CreatedAt = p38.CreatedAt;
|
|
result.ModifiedAt = p38.ModifiedAt;
|
|
return result;
|
|
|
|
}
|
|
public static ProductSDto AdaptToSDto(this Product p44)
|
|
{
|
|
return p44 == null ? null : new ProductSDto()
|
|
{
|
|
PersianName = p44.PersianName,
|
|
Slug = p44.Slug,
|
|
EnglishName = p44.EnglishName,
|
|
Summery = p44.Summery,
|
|
ExpertCheck = p44.ExpertCheck,
|
|
Tags = p44.Tags,
|
|
Warranty = p44.Warranty,
|
|
Cost = p44.Cost,
|
|
IsEnable = p44.IsEnable,
|
|
Stock = p44.Stock,
|
|
MaxOrderCount = p44.MaxOrderCount,
|
|
BeDisplayed = p44.BeDisplayed,
|
|
PackingCost = p44.PackingCost,
|
|
Rate = p44.Rate,
|
|
ReviewCount = p44.ReviewCount,
|
|
Viewed = p44.Viewed,
|
|
MainImage = p44.Files.FirstOrDefault<ProductStorageFile>(funcMain17) != null ? p44.Files.FirstOrDefault<ProductStorageFile>(funcMain18).FileLocation : (p44.Files.Count > 0 ? p44.Files.FirstOrDefault<ProductStorageFile>().FileLocation : string.Empty),
|
|
CategoryId = p44.CategoryId,
|
|
BrandId = p44.BrandId,
|
|
CategoryName = p44.Category == null ? null : p44.Category.Name,
|
|
ModifiedAt = p44.ModifiedAt,
|
|
Id = p44.Id,
|
|
CreatedAt = p44.CreatedAt
|
|
};
|
|
}
|
|
public static ProductSDto AdaptTo(this Product p45, ProductSDto p46)
|
|
{
|
|
if (p45 == null)
|
|
{
|
|
return null;
|
|
}
|
|
ProductSDto result = p46 ?? new ProductSDto();
|
|
|
|
result.PersianName = p45.PersianName;
|
|
result.Slug = p45.Slug;
|
|
result.EnglishName = p45.EnglishName;
|
|
result.Summery = p45.Summery;
|
|
result.ExpertCheck = p45.ExpertCheck;
|
|
result.Tags = p45.Tags;
|
|
result.Warranty = p45.Warranty;
|
|
result.Cost = p45.Cost;
|
|
result.IsEnable = p45.IsEnable;
|
|
result.Stock = p45.Stock;
|
|
result.MaxOrderCount = p45.MaxOrderCount;
|
|
result.BeDisplayed = p45.BeDisplayed;
|
|
result.PackingCost = p45.PackingCost;
|
|
result.Rate = p45.Rate;
|
|
result.ReviewCount = p45.ReviewCount;
|
|
result.Viewed = p45.Viewed;
|
|
result.MainImage = p45.Files.FirstOrDefault<ProductStorageFile>(funcMain17) != null ? p45.Files.FirstOrDefault<ProductStorageFile>(funcMain18).FileLocation : (p45.Files.Count > 0 ? p45.Files.FirstOrDefault<ProductStorageFile>().FileLocation : string.Empty);
|
|
result.CategoryId = p45.CategoryId;
|
|
result.BrandId = p45.BrandId;
|
|
result.CategoryName = p45.Category == null ? null : p45.Category.Name;
|
|
result.ModifiedAt = p45.ModifiedAt;
|
|
result.Id = p45.Id;
|
|
result.CreatedAt = p45.CreatedAt;
|
|
return result;
|
|
|
|
}
|
|
public static Expression<Func<Product, ProductSDto>> ProjectToSDto => p47 => new ProductSDto()
|
|
{
|
|
PersianName = p47.PersianName,
|
|
Slug = p47.Slug,
|
|
EnglishName = p47.EnglishName,
|
|
Summery = p47.Summery,
|
|
ExpertCheck = p47.ExpertCheck,
|
|
Tags = p47.Tags,
|
|
Warranty = p47.Warranty,
|
|
Cost = p47.Cost,
|
|
IsEnable = p47.IsEnable,
|
|
Stock = p47.Stock,
|
|
MaxOrderCount = p47.MaxOrderCount,
|
|
BeDisplayed = p47.BeDisplayed,
|
|
PackingCost = p47.PackingCost,
|
|
Rate = p47.Rate,
|
|
ReviewCount = p47.ReviewCount,
|
|
Viewed = p47.Viewed,
|
|
MainImage = p47.Files.FirstOrDefault<ProductStorageFile>(f => f.IsPrimary) != null ? p47.Files.FirstOrDefault<ProductStorageFile>(f => f.IsPrimary).FileLocation : (p47.Files.Count > 0 ? p47.Files.FirstOrDefault<ProductStorageFile>().FileLocation : string.Empty),
|
|
CategoryId = p47.CategoryId,
|
|
BrandId = p47.BrandId,
|
|
CategoryName = p47.Category.Name,
|
|
ModifiedAt = p47.ModifiedAt,
|
|
Id = p47.Id,
|
|
CreatedAt = p47.CreatedAt
|
|
};
|
|
public static Expression<Func<Product, TorobProductResponseDto>> ProjectToTorobResponseDto => p48 => new TorobProductResponseDto()
|
|
{
|
|
product_id = p48.Id.ToString(),
|
|
price = p48.Cost,
|
|
availibility = p48.IsEnable
|
|
};
|
|
|
|
private static List<Specification> funcMain1(List<SpecificationSDto> p2)
|
|
{
|
|
if (p2 == null)
|
|
{
|
|
return null;
|
|
}
|
|
List<Specification> result = new List<Specification>(p2.Count);
|
|
|
|
int i = 0;
|
|
int len = p2.Count;
|
|
|
|
while (i < len)
|
|
{
|
|
SpecificationSDto item = p2[i];
|
|
result.Add(item == null ? null : new Specification()
|
|
{
|
|
Title = item.Title,
|
|
Detail = item.Detail,
|
|
Value = item.Value,
|
|
IsFeature = item.IsFeature,
|
|
ProductId = item.ProductId,
|
|
ParentId = (Guid?)item.ParentId,
|
|
Id = item.Id,
|
|
CreatedAt = item.CreatedAt
|
|
});
|
|
i++;
|
|
}
|
|
return result;
|
|
|
|
}
|
|
|
|
private static List<Review> funcMain2(List<ReviewSDto> p3)
|
|
{
|
|
if (p3 == null)
|
|
{
|
|
return null;
|
|
}
|
|
List<Review> result = new List<Review>(p3.Count);
|
|
|
|
int i = 0;
|
|
int len = p3.Count;
|
|
|
|
while (i < len)
|
|
{
|
|
ReviewSDto item = p3[i];
|
|
result.Add(item == null ? null : new Review()
|
|
{
|
|
Title = item.Title,
|
|
Comment = item.Comment,
|
|
Rate = item.Rate,
|
|
IsBuyer = item.IsBuyer,
|
|
ProductId = item.ProductId,
|
|
UserId = item.UserId,
|
|
Id = item.Id,
|
|
CreatedAt = item.CreatedAt
|
|
});
|
|
i++;
|
|
}
|
|
return result;
|
|
|
|
}
|
|
|
|
private static List<ProductStorageFile> funcMain3(List<StorageFileSDto> p4)
|
|
{
|
|
if (p4 == null)
|
|
{
|
|
return null;
|
|
}
|
|
List<ProductStorageFile> result = new List<ProductStorageFile>(p4.Count);
|
|
|
|
int i = 0;
|
|
int len = p4.Count;
|
|
|
|
while (i < len)
|
|
{
|
|
StorageFileSDto item = p4[i];
|
|
result.Add(item == null ? null : new ProductStorageFile()
|
|
{
|
|
Name = item.Name,
|
|
FileLocation = item.FileLocation,
|
|
FileName = item.FileName,
|
|
IsHeader = item.IsHeader,
|
|
IsPrimary = item.IsPrimary,
|
|
FileType = item.FileType,
|
|
Id = item.Id,
|
|
CreatedAt = item.CreatedAt
|
|
});
|
|
i++;
|
|
}
|
|
return result;
|
|
|
|
}
|
|
|
|
private static Brand funcMain4(Never p7, Brand p8, ProductLDto p5)
|
|
{
|
|
Brand result = p8 ?? new Brand();
|
|
|
|
result.Id = p5.BrandId;
|
|
return result;
|
|
|
|
}
|
|
|
|
private static ProductCategory funcMain5(Never p9, ProductCategory p10, ProductLDto p5)
|
|
{
|
|
ProductCategory result = p10 ?? new ProductCategory();
|
|
|
|
result.Name = p5.CategoryName;
|
|
result.Id = p5.CategoryId;
|
|
return result;
|
|
|
|
}
|
|
|
|
private static List<Specification> funcMain6(List<SpecificationSDto> p11, List<Specification> p12)
|
|
{
|
|
if (p11 == null)
|
|
{
|
|
return null;
|
|
}
|
|
List<Specification> result = new List<Specification>(p11.Count);
|
|
|
|
int i = 0;
|
|
int len = p11.Count;
|
|
|
|
while (i < len)
|
|
{
|
|
SpecificationSDto item = p11[i];
|
|
result.Add(item == null ? null : new Specification()
|
|
{
|
|
Title = item.Title,
|
|
Detail = item.Detail,
|
|
Value = item.Value,
|
|
IsFeature = item.IsFeature,
|
|
ProductId = item.ProductId,
|
|
ParentId = (Guid?)item.ParentId,
|
|
Id = item.Id,
|
|
CreatedAt = item.CreatedAt
|
|
});
|
|
i++;
|
|
}
|
|
return result;
|
|
|
|
}
|
|
|
|
private static List<Review> funcMain7(List<ReviewSDto> p13, List<Review> p14)
|
|
{
|
|
if (p13 == null)
|
|
{
|
|
return null;
|
|
}
|
|
List<Review> result = new List<Review>(p13.Count);
|
|
|
|
int i = 0;
|
|
int len = p13.Count;
|
|
|
|
while (i < len)
|
|
{
|
|
ReviewSDto item = p13[i];
|
|
result.Add(item == null ? null : new Review()
|
|
{
|
|
Title = item.Title,
|
|
Comment = item.Comment,
|
|
Rate = item.Rate,
|
|
IsBuyer = item.IsBuyer,
|
|
ProductId = item.ProductId,
|
|
UserId = item.UserId,
|
|
Id = item.Id,
|
|
CreatedAt = item.CreatedAt
|
|
});
|
|
i++;
|
|
}
|
|
return result;
|
|
|
|
}
|
|
|
|
private static List<ProductStorageFile> funcMain8(List<StorageFileSDto> p15, List<ProductStorageFile> p16)
|
|
{
|
|
if (p15 == null)
|
|
{
|
|
return null;
|
|
}
|
|
List<ProductStorageFile> result = new List<ProductStorageFile>(p15.Count);
|
|
|
|
int i = 0;
|
|
int len = p15.Count;
|
|
|
|
while (i < len)
|
|
{
|
|
StorageFileSDto item = p15[i];
|
|
result.Add(item == null ? null : new ProductStorageFile()
|
|
{
|
|
Name = item.Name,
|
|
FileLocation = item.FileLocation,
|
|
FileName = item.FileName,
|
|
IsHeader = item.IsHeader,
|
|
IsPrimary = item.IsPrimary,
|
|
FileType = item.FileType,
|
|
Id = item.Id,
|
|
CreatedAt = item.CreatedAt
|
|
});
|
|
i++;
|
|
}
|
|
return result;
|
|
|
|
}
|
|
|
|
private static List<SpecificationSDto> funcMain9(List<Specification> p22)
|
|
{
|
|
if (p22 == null)
|
|
{
|
|
return null;
|
|
}
|
|
List<SpecificationSDto> result = new List<SpecificationSDto>(p22.Count);
|
|
|
|
int i = 0;
|
|
int len = p22.Count;
|
|
|
|
while (i < len)
|
|
{
|
|
Specification item = p22[i];
|
|
result.Add(item == null ? null : new SpecificationSDto()
|
|
{
|
|
Title = item.Title,
|
|
Detail = item.Detail,
|
|
Value = item.Value,
|
|
IsFeature = item.IsFeature,
|
|
ProductId = item.ProductId,
|
|
ParentId = item.ParentId == null ? default(Guid) : (Guid)item.ParentId,
|
|
Id = item.Id,
|
|
CreatedAt = item.CreatedAt
|
|
});
|
|
i++;
|
|
}
|
|
return result;
|
|
|
|
}
|
|
|
|
private static List<ReviewSDto> funcMain10(List<Review> p23)
|
|
{
|
|
if (p23 == null)
|
|
{
|
|
return null;
|
|
}
|
|
List<ReviewSDto> result = new List<ReviewSDto>(p23.Count);
|
|
|
|
int i = 0;
|
|
int len = p23.Count;
|
|
|
|
while (i < len)
|
|
{
|
|
Review item = p23[i];
|
|
result.Add(item == null ? null : new ReviewSDto()
|
|
{
|
|
Title = item.Title,
|
|
Comment = item.Comment,
|
|
Rate = item.Rate,
|
|
IsBuyer = item.IsBuyer,
|
|
ProductId = item.ProductId,
|
|
UserId = item.UserId,
|
|
Id = item.Id,
|
|
CreatedAt = item.CreatedAt
|
|
});
|
|
i++;
|
|
}
|
|
return result;
|
|
|
|
}
|
|
|
|
private static List<StorageFileSDto> funcMain11(List<ProductStorageFile> p24)
|
|
{
|
|
if (p24 == null)
|
|
{
|
|
return null;
|
|
}
|
|
List<StorageFileSDto> result = new List<StorageFileSDto>(p24.Count);
|
|
|
|
int i = 0;
|
|
int len = p24.Count;
|
|
|
|
while (i < len)
|
|
{
|
|
ProductStorageFile item = p24[i];
|
|
result.Add(item == null ? null : new StorageFileSDto()
|
|
{
|
|
Name = item.Name,
|
|
FileLocation = item.FileLocation,
|
|
FileName = item.FileName,
|
|
IsHeader = item.IsHeader,
|
|
IsPrimary = item.IsPrimary,
|
|
FileType = item.FileType,
|
|
Id = item.Id
|
|
});
|
|
i++;
|
|
}
|
|
return result;
|
|
|
|
}
|
|
|
|
private static List<SpecificationSDto> funcMain12(List<Specification> p27, List<SpecificationSDto> p28)
|
|
{
|
|
if (p27 == null)
|
|
{
|
|
return null;
|
|
}
|
|
List<SpecificationSDto> result = new List<SpecificationSDto>(p27.Count);
|
|
|
|
int i = 0;
|
|
int len = p27.Count;
|
|
|
|
while (i < len)
|
|
{
|
|
Specification item = p27[i];
|
|
result.Add(item == null ? null : new SpecificationSDto()
|
|
{
|
|
Title = item.Title,
|
|
Detail = item.Detail,
|
|
Value = item.Value,
|
|
IsFeature = item.IsFeature,
|
|
ProductId = item.ProductId,
|
|
ParentId = item.ParentId == null ? default(Guid) : (Guid)item.ParentId,
|
|
Id = item.Id,
|
|
CreatedAt = item.CreatedAt
|
|
});
|
|
i++;
|
|
}
|
|
return result;
|
|
|
|
}
|
|
|
|
private static List<ReviewSDto> funcMain13(List<Review> p29, List<ReviewSDto> p30)
|
|
{
|
|
if (p29 == null)
|
|
{
|
|
return null;
|
|
}
|
|
List<ReviewSDto> result = new List<ReviewSDto>(p29.Count);
|
|
|
|
int i = 0;
|
|
int len = p29.Count;
|
|
|
|
while (i < len)
|
|
{
|
|
Review item = p29[i];
|
|
result.Add(item == null ? null : new ReviewSDto()
|
|
{
|
|
Title = item.Title,
|
|
Comment = item.Comment,
|
|
Rate = item.Rate,
|
|
IsBuyer = item.IsBuyer,
|
|
ProductId = item.ProductId,
|
|
UserId = item.UserId,
|
|
Id = item.Id,
|
|
CreatedAt = item.CreatedAt
|
|
});
|
|
i++;
|
|
}
|
|
return result;
|
|
|
|
}
|
|
|
|
private static List<StorageFileSDto> funcMain14(List<ProductStorageFile> p31, List<StorageFileSDto> p32)
|
|
{
|
|
if (p31 == null)
|
|
{
|
|
return null;
|
|
}
|
|
List<StorageFileSDto> result = new List<StorageFileSDto>(p31.Count);
|
|
|
|
int i = 0;
|
|
int len = p31.Count;
|
|
|
|
while (i < len)
|
|
{
|
|
ProductStorageFile item = p31[i];
|
|
result.Add(item == null ? null : new StorageFileSDto()
|
|
{
|
|
Name = item.Name,
|
|
FileLocation = item.FileLocation,
|
|
FileName = item.FileName,
|
|
IsHeader = item.IsHeader,
|
|
IsPrimary = item.IsPrimary,
|
|
FileType = item.FileType,
|
|
Id = item.Id
|
|
});
|
|
i++;
|
|
}
|
|
return result;
|
|
|
|
}
|
|
|
|
private static Brand funcMain15(Never p40, Brand p41, ProductSDto p38)
|
|
{
|
|
Brand result = p41 ?? new Brand();
|
|
|
|
result.Id = p38.BrandId;
|
|
return result;
|
|
|
|
}
|
|
|
|
private static ProductCategory funcMain16(Never p42, ProductCategory p43, ProductSDto p38)
|
|
{
|
|
ProductCategory result = p43 ?? new ProductCategory();
|
|
|
|
result.Name = p38.CategoryName;
|
|
result.Id = p38.CategoryId;
|
|
return result;
|
|
|
|
}
|
|
|
|
private static bool funcMain17(ProductStorageFile f)
|
|
{
|
|
return f.IsPrimary;
|
|
}
|
|
|
|
private static bool funcMain18(ProductStorageFile f)
|
|
{
|
|
return f.IsPrimary;
|
|
}
|
|
}
|
|
} |