Add MetaTags support and update project configurations
- Removed unused @using directives in App.razor and BrandsPage.razor. - Added UI elements for meta tags in BrandActionDialogBox.razor. - Updated BrandActionDialogBoxViewModel to handle meta tags. - Changed label text in DiscountActionDialogBox.razor. - Updated assembly and file versions in Netina.AdminPanel.PWA.csproj. - Added BlogMetaTag and BrandMetaTag classes. - Added migration to update database schema for meta tags. - Updated BlogController to handle meta tags. - Set LangVersion to latest in multiple project files. - Changed array initialization syntax in various files. - Added MetaTags property to BlogLDto and BrandLDto classes. - Updated Blog and Brand classes to handle meta tags. - Refactored mappers to include meta tags handling. - Improved product sorting in GetProductsQueryHandler.cs. - Updated ApplicationContextModelSnapshot for new entities.subProduct
parent
53dc2eac0c
commit
559ab04d9b
|
@ -1,5 +1,4 @@
|
|||
using Microsoft.Extensions.Options;
|
||||
using Netina.Api.Services;
|
||||
using Netina.Domain.Entities.Blogs;
|
||||
using System.Web;
|
||||
using Netina.Repository.Abstracts;
|
||||
|
@ -98,6 +97,8 @@ public class BlogController : ICarterModule
|
|||
{
|
||||
ent.AddFile(file.Name, file.FileLocation, file.FileName, file.IsHeader, file.IsPrimary, file.FileType);
|
||||
}
|
||||
foreach (var item in dto.MetaTags)
|
||||
ent.AddMetaTag(item.Type, item.Value);
|
||||
|
||||
repositoryWrapper.SetRepository<Blog>().Add(ent);
|
||||
await repositoryWrapper.SaveChangesAsync(cancellationToken);
|
||||
|
@ -133,6 +134,21 @@ public class BlogController : ICarterModule
|
|||
foreach (var file in dto.Files.Where(f => f.Id == default))
|
||||
newEnt.AddFile(file.Name, file.FileLocation, file.FileName, file.IsHeader, file.IsPrimary, file.FileType);
|
||||
|
||||
|
||||
//Check MetaTags
|
||||
var dbMetaTags = await repositoryWrapper.SetRepository<BlogMetaTag>()
|
||||
.TableNoTracking
|
||||
.Where(f => f.BlogId == ent.Id)
|
||||
.ToListAsync(cancellationToken);
|
||||
foreach (var feature in dbMetaTags.Where(feature => dto.MetaTags.Any(f => f.Type == feature.Type) == false))
|
||||
{
|
||||
repositoryWrapper.SetRepository<BlogMetaTag>()
|
||||
.Delete(feature);
|
||||
await repositoryWrapper.SaveChangesAsync(cancellationToken);
|
||||
}
|
||||
foreach (var item in dto.MetaTags.Where(f => dbMetaTags.Any(dbf => dbf.Type == f.Type) == false))
|
||||
newEnt.AddMetaTag(item.Type, item.Value);
|
||||
|
||||
repositoryWrapper.SetRepository<Blog>().Update(newEnt);
|
||||
await repositoryWrapper.SaveChangesAsync(cancellationToken);
|
||||
return TypedResults.Ok();
|
||||
|
|
|
@ -6,8 +6,9 @@
|
|||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<InvariantGlobalization>true</InvariantGlobalization>
|
||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
<AssemblyVersion>1.7.20.34</AssemblyVersion>
|
||||
<FileVersion>1.7.20.34</FileVersion>
|
||||
<AssemblyVersion>1.10.21.36</AssemblyVersion>
|
||||
<FileVersion>1.10.21.36</FileVersion>
|
||||
<LangVersion>latest</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -52,14 +52,14 @@ public static class ServiceExtensions
|
|||
{
|
||||
new()
|
||||
{
|
||||
Hosts = new[]
|
||||
{
|
||||
Hosts =
|
||||
[
|
||||
new RedisHost
|
||||
{
|
||||
Port = siteSettings.MasterRedisConfiguration.Port,
|
||||
Host = siteSettings.MasterRedisConfiguration.Host
|
||||
}
|
||||
},
|
||||
],
|
||||
Password = siteSettings.MasterRedisConfiguration.Password,
|
||||
Ssl = false
|
||||
}
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<LangVersion>latest</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -16,7 +17,7 @@
|
|||
|
||||
<!--<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<LangVersion>10</LangVersion>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
|
@ -26,7 +27,7 @@
|
|||
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
|
||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="7.3.1" />
|
||||
</ItemGroup>-->
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<Using Include="MD.PersianDateTime.Standard" />
|
||||
<Using Include="Newtonsoft.Json" />
|
||||
|
|
|
@ -7,12 +7,12 @@ public static class SiteMapUIds
|
|||
public const string BlogCategories = "B5FF333DC4FF4BB4A309CE3AA32CE45A";
|
||||
public const string Pages = "B463B6C4CC53432C822D79934F528D3E";
|
||||
|
||||
public static List<string> AllSiteMapsUIds => new List<string>
|
||||
{
|
||||
public static List<string> AllSiteMapsUIds =>
|
||||
[
|
||||
BlogCategories,
|
||||
Categories,
|
||||
Blogs,
|
||||
Brands,
|
||||
Pages
|
||||
};
|
||||
];
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<LangVersion>latest</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
|
|
|
@ -16,5 +16,6 @@ public class BlogLDto : BaseDto<BlogLDto , Blog>
|
|||
public string CategoryName { get; set; } = string.Empty;
|
||||
public Guid AuthorId { get; set; }
|
||||
public string AuthorFullName { get; set; } = string.Empty;
|
||||
public List<MetaTagSDto> MetaTags { get; set; } = new();
|
||||
public List<StorageFileSDto> Files { get; set; } = new();
|
||||
}
|
|
@ -10,4 +10,5 @@ public class BrandLDto : BaseDto<BrandLDto,Brand>
|
|||
public string PageUrl { get; set; } = string.Empty;
|
||||
public string HeaderFileName { get; set; } = string.Empty;
|
||||
public List<StorageFileSDto> Files { get; internal set; } = new();
|
||||
public List<MetaTagSDto> MetaTags { get; set; } = new();
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
namespace Netina.Domain.Entities.Accounting;
|
||||
|
||||
[AdaptTwoWays("[name]LDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
|
||||
[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget)]
|
||||
[AdaptTo("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Projection)]
|
||||
[AdaptTwoWays("[name]LDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
|
||||
[AdaptTwoWays("[name]SDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Map | MapType.MapToTarget)]
|
||||
[AdaptTo("[name]SDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Projection)]
|
||||
[GenerateMapper]
|
||||
|
||||
public partial class Payment : ApiEntity
|
||||
|
|
|
@ -8,6 +8,9 @@ public partial class Blog
|
|||
return new Blog(title, slug, content, tags, readingTime, summery, isSuggested, categoryId,authorId);
|
||||
}
|
||||
|
||||
public void AddMetaTag(string key, string value)
|
||||
=> MetaTags.Add(BlogMetaTag.Create(key, value, Id));
|
||||
|
||||
public static Blog Create(string title, string slug, string content, string tags, int readingTime, string summery, bool isSuggested, Guid categoryId, Guid authorId)
|
||||
{
|
||||
if (slug.IsNullOrEmpty())
|
||||
|
@ -22,6 +25,12 @@ public partial class Blog
|
|||
}
|
||||
}
|
||||
|
||||
public partial class BlogMetaTag
|
||||
{
|
||||
public static BlogMetaTag Create(string key, string value, Guid brandId)
|
||||
=> new(key, value, brandId);
|
||||
}
|
||||
|
||||
public partial class BlogStorageFile
|
||||
{
|
||||
public static BlogStorageFile Create(string name, string fileLocation, string fileName, bool isHeader, bool isPrimary, StorageFileType fileType, Guid blogId)
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
namespace Netina.Domain.Entities.Blogs;
|
||||
|
||||
[AdaptTwoWays("[name]LDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
|
||||
[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget)]
|
||||
[AdaptTo("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Projection)]
|
||||
[AdaptTwoWays("[name]LDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
|
||||
[AdaptTwoWays("[name]SDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Map | MapType.MapToTarget)]
|
||||
[AdaptTo("[name]SDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Projection)]
|
||||
[GenerateMapper]
|
||||
|
||||
public partial class Blog : ApiEntity
|
||||
|
@ -32,7 +32,8 @@ public partial class Blog : ApiEntity
|
|||
public bool IsSuggested { get; internal set; }
|
||||
public Guid CategoryId { get; internal set; }
|
||||
public BlogCategory? Category { get; internal set; }
|
||||
public List<BlogStorageFile> Files { get; internal set; } = new();
|
||||
public List<BlogStorageFile> Files { get; internal set; } = [];
|
||||
public List<BlogMetaTag> MetaTags { get; set; } = [];
|
||||
public Guid AuthorId { get; internal set; }
|
||||
public ApplicationUser? Author { get; internal set; }
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
namespace Netina.Domain.Entities.Blogs;
|
||||
[AdaptTwoWays("[name]LDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
|
||||
[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget)]
|
||||
[AdaptTo("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Projection)]
|
||||
[AdaptTwoWays("[name]LDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
|
||||
[AdaptTwoWays("[name]SDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Map | MapType.MapToTarget)]
|
||||
[AdaptTo("[name]SDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Projection)]
|
||||
[GenerateMapper]
|
||||
public partial class BlogCategory : ApiEntity
|
||||
{
|
||||
|
@ -23,5 +23,5 @@ public partial class BlogCategory : ApiEntity
|
|||
public bool IsMain { get; set; }
|
||||
public Guid? ParentId { get; set; }
|
||||
public BlogCategory? Parent { get; set; }
|
||||
public List<Blog> Blogs { get; internal set; } = new();
|
||||
public List<Blog> Blogs { get; internal set; } = [];
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
namespace Netina.Domain.Entities.Blogs;
|
||||
|
||||
public partial class BlogMetaTag : MetaTag
|
||||
{
|
||||
public BlogMetaTag()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public BlogMetaTag(string type, string value, Guid blogId) : base(type, value)
|
||||
{
|
||||
BlogId = blogId;
|
||||
}
|
||||
|
||||
public Guid BlogId { get; set; }
|
||||
public Blog? Brand { get; set; }
|
||||
}
|
|
@ -9,6 +9,9 @@ public partial class Brand
|
|||
return new Brand(persianName, slug, englishName, description, hasSpecialPage, pageUrl);
|
||||
}
|
||||
|
||||
public void AddMetaTag(string key, string value)
|
||||
=> MetaTags.Add(BrandMetaTag.Create(key, value, Id));
|
||||
|
||||
public BrandStorageFile AddFile(string name, string fileLocation, string fileName, bool isHeader, bool isPrimary, StorageFileType fileType)
|
||||
{
|
||||
var file = BrandStorageFile.Create(name, fileLocation, fileName, isHeader, isPrimary, fileType, this.Id);
|
||||
|
@ -17,6 +20,12 @@ public partial class Brand
|
|||
}
|
||||
}
|
||||
|
||||
public partial class BrandMetaTag
|
||||
{
|
||||
public static BrandMetaTag Create(string key, string value, Guid brandId)
|
||||
=> new (key, value, brandId);
|
||||
}
|
||||
|
||||
public partial class BrandStorageFile
|
||||
{
|
||||
public static BrandStorageFile Create(string name, string fileLocation, string fileName, bool isHeader, bool isPrimary, StorageFileType fileType, Guid brandId)
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
namespace Netina.Domain.Entities.Brands;
|
||||
|
||||
[AdaptTwoWays("[name]LDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
|
||||
[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget)]
|
||||
[AdaptTo("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Projection)]
|
||||
[AdaptTwoWays("[name]LDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
|
||||
[AdaptTwoWays("[name]SDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Map | MapType.MapToTarget)]
|
||||
[AdaptTo("[name]SDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Projection)]
|
||||
[GenerateMapper]
|
||||
|
||||
//[Index(nameof(Slug), IsUnique = true)]
|
||||
|
@ -28,6 +28,7 @@ public partial class Brand : ApiEntity
|
|||
public string Description { get; internal set; } = string.Empty;
|
||||
public bool HasSpecialPage { get; internal set; }
|
||||
public string PageUrl { get; internal set; } = string.Empty;
|
||||
public List<Product> Products { get; internal set; } = new();
|
||||
public List<BrandStorageFile> Files { get; internal set; } = new();
|
||||
public List<Product> Products { get; internal set; } = [];
|
||||
public List<BrandStorageFile> Files { get; internal set; } = [];
|
||||
public List<BrandMetaTag> MetaTags { get; set; } = [];
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
namespace Netina.Domain.Entities.Brands;
|
||||
|
||||
public partial class BrandMetaTag : MetaTag
|
||||
{
|
||||
public BrandMetaTag()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public BrandMetaTag(string type, string value, Guid branId) : base(type, value)
|
||||
{
|
||||
BrandId = branId;
|
||||
}
|
||||
|
||||
public Guid BrandId { get; set; }
|
||||
public Brand? Brand { get; set; }
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
namespace Netina.Domain.Entities.Comments;
|
||||
[AdaptTwoWays("[name]LDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
|
||||
[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget)]
|
||||
[AdaptTo("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Projection)]
|
||||
[AdaptTwoWays("[name]LDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
|
||||
[AdaptTwoWays("[name]SDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Map | MapType.MapToTarget)]
|
||||
[AdaptTo("[name]SDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Projection)]
|
||||
[GenerateMapper]
|
||||
public partial class Comment : ApiEntity
|
||||
{
|
||||
|
@ -29,7 +29,7 @@ public partial class Comment : ApiEntity
|
|||
public Comment? Parent { get; internal set; }
|
||||
|
||||
|
||||
public List<Comment> Children { get; internal set; } = new();
|
||||
public List<Comment> Children { get; internal set; } = [];
|
||||
|
||||
public Guid UserId { get; internal set; }
|
||||
public ApplicationUser? User { get; internal set; }
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
namespace Netina.Domain.Entities.Discounts;
|
||||
|
||||
[AdaptTwoWays("[name]LDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
|
||||
[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget)]
|
||||
[AdaptTo("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Projection)]
|
||||
[AdaptTwoWays("[name]LDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
|
||||
[AdaptTwoWays("[name]SDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Map | MapType.MapToTarget)]
|
||||
[AdaptTo("[name]SDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Projection)]
|
||||
[GenerateMapper]
|
||||
|
||||
public partial class Discount : ApiEntity
|
||||
|
@ -80,5 +80,5 @@ public partial class Discount : ApiEntity
|
|||
public Guid? MarketerId { get; internal set; }
|
||||
public Marketer? Marketer { get; internal set; }
|
||||
|
||||
public List<Order> Orders { get; internal set; } = new();
|
||||
public List<Order> Orders { get; internal set; } = [];
|
||||
}
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
namespace Netina.Domain.Entities.Orders;
|
||||
|
||||
[AdaptTwoWays("[name]LDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
|
||||
[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget)]
|
||||
[AdaptTo("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Projection)]
|
||||
[AdaptTwoWays("[name]LDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
|
||||
[AdaptTwoWays("[name]SDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Map | MapType.MapToTarget)]
|
||||
[AdaptTo("[name]SDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Projection)]
|
||||
[GenerateMapper]
|
||||
|
||||
public partial class Order : ApiEntity
|
||||
|
@ -75,8 +75,8 @@ public partial class Order : ApiEntity
|
|||
|
||||
public OrderDelivery? OrderDelivery { get; set; }
|
||||
|
||||
public List<OrderProduct> OrderProducts { get; internal set; } = new();
|
||||
public List<OrderProduct> OrderProducts { get; internal set; } = [];
|
||||
|
||||
|
||||
public List<Payment> Payments { get; internal set; } = new();
|
||||
public List<Payment> Payments { get; internal set; } = [];
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
namespace Netina.Domain.Entities.Orders;
|
||||
|
||||
[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget)]
|
||||
[AdaptTo("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Projection)]
|
||||
[AdaptTwoWays("[name]SDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Map | MapType.MapToTarget)]
|
||||
[AdaptTo("[name]SDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Projection)]
|
||||
[GenerateMapper]
|
||||
public partial class OrderProduct : ApiEntity
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
namespace Netina.Domain.Entities.ProductCategories;
|
||||
|
||||
[AdaptTwoWays("[name]LDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
|
||||
[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget)]
|
||||
[AdaptTo("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Projection)]
|
||||
[AdaptTwoWays("[name]LDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
|
||||
[AdaptTwoWays("[name]SDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Map | MapType.MapToTarget)]
|
||||
[AdaptTo("[name]SDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Projection)]
|
||||
[GenerateMapper]
|
||||
public partial class ProductCategory : ApiEntity
|
||||
{
|
||||
|
@ -27,7 +27,7 @@ public partial class ProductCategory : ApiEntity
|
|||
public ProductCategory? Parent { get; internal set; }
|
||||
|
||||
//public List<ProductCategory> Children { get; internal set; } = new();
|
||||
public List<ProductCategoryMetaTag> MetaTags { get; internal set; } = new();
|
||||
public List<Product> Products { get; internal set; } = new();
|
||||
public List<ProductCategoryStorageFile> Files { get; internal set; } = new();
|
||||
public List<ProductCategoryMetaTag> MetaTags { get; internal set; } = [];
|
||||
public List<Product> Products { get; internal set; } = [];
|
||||
public List<ProductCategoryStorageFile> Files { get; internal set; } = [];
|
||||
}
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
namespace Netina.Domain.Entities.Products;
|
||||
|
||||
[AdaptTwoWays("[name]LDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
|
||||
[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget )]
|
||||
[AdaptTo("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Projection)]
|
||||
[AdaptTo("TorobProductResponseDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Projection)]
|
||||
[AdaptTwoWays("[name]LDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
|
||||
[AdaptTwoWays("[name]SDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Map | MapType.MapToTarget )]
|
||||
[AdaptTo("[name]SDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Projection)]
|
||||
[AdaptTo("TorobProductResponseDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Projection)]
|
||||
//[AdaptTo("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Projection)]
|
||||
[GenerateMapper]
|
||||
|
||||
|
@ -81,11 +81,11 @@ public partial class Product : ApiEntity
|
|||
public ApplicationUser? Author { get; internal set; }
|
||||
public ProductCategory? Category { get; internal set; }
|
||||
|
||||
public List<Specification> Specifications { get; internal set; } = new();
|
||||
public List<ProductComment> Comments { get; internal set; } = new();
|
||||
public List<ProductStorageFile> Files { get; internal set; } = new();
|
||||
public List<Specification> Specifications { get; internal set; } = [];
|
||||
public List<ProductComment> Comments { get; internal set; } = [];
|
||||
public List<ProductStorageFile> Files { get; internal set; } = [];
|
||||
|
||||
public List<ProductMetaTag> MetaTags { get; internal set; } = new();
|
||||
public List<ProductMetaTag> MetaTags { get; internal set; } = [];
|
||||
|
||||
public List<OrderProduct> OrderProducts { get; internal set; } = new();
|
||||
public List<OrderProduct> OrderProducts { get; internal set; } = [];
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
namespace Netina.Domain.Entities.Products;
|
||||
[AdaptTwoWays("[name]LDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
|
||||
[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget)]
|
||||
[AdaptTo("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Projection)]
|
||||
[AdaptTwoWays("[name]LDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
|
||||
[AdaptTwoWays("[name]SDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Map | MapType.MapToTarget)]
|
||||
[AdaptTo("[name]SDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Projection)]
|
||||
[GenerateMapper]
|
||||
public partial class Specification : ApiEntity
|
||||
{
|
||||
|
@ -33,5 +33,5 @@ public partial class Specification : ApiEntity
|
|||
public Guid? ParentId { get; internal set; }
|
||||
public Specification? Parent { get; internal set; }
|
||||
|
||||
public List<Specification> Children { get; internal set; } = new();
|
||||
public List<Specification> Children { get; internal set; } = [];
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
namespace Netina.Domain.Entities.Seo;
|
||||
|
||||
[AdaptTwoWays("[name]LDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
|
||||
[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget)]
|
||||
[AdaptTo("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Projection)]
|
||||
[AdaptTwoWays("[name]LDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
|
||||
[AdaptTwoWays("[name]SDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Map | MapType.MapToTarget)]
|
||||
[AdaptTo("[name]SDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Projection)]
|
||||
[GenerateMapper]
|
||||
public partial class MetaTag : ApiEntity
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
namespace Netina.Domain.Entities.StorageFiles;
|
||||
[AdaptTwoWays("[name]LDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
|
||||
[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget)]
|
||||
[AdaptTo("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Projection)]
|
||||
[AdaptTwoWays("[name]LDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
|
||||
[AdaptTwoWays("[name]SDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Map | MapType.MapToTarget)]
|
||||
[AdaptTo("[name]SDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Projection)]
|
||||
[GenerateMapper]
|
||||
public partial class StorageFile : ApiEntity
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
namespace Netina.Domain.Entities.Users;
|
||||
|
||||
[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget )]
|
||||
[AdaptTo("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Projection)]
|
||||
[AdaptTwoWays("[name]SDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Map | MapType.MapToTarget )]
|
||||
[AdaptTo("[name]SDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Projection)]
|
||||
|
||||
[GenerateMapper]
|
||||
public class ApplicationUser : IdentityUser<Guid>
|
||||
|
@ -13,7 +13,7 @@ public class ApplicationUser : IdentityUser<Guid>
|
|||
public DateTime BirthDate { get; set; }
|
||||
public Gender Gender { get; set; }
|
||||
public SignUpStatus SignUpStatus { get; set; }
|
||||
public List<UserAddress> Addresses { get; set; } = new();
|
||||
public List<UserAddress> Addresses { get; set; } = [];
|
||||
|
||||
public Manager? Manager { get; set; }
|
||||
public Customer? Customer { get; set; }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
namespace Netina.Domain.Entities.Users;
|
||||
|
||||
[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget)]
|
||||
[AdaptTo("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Projection)]
|
||||
[AdaptTwoWays("[name]SDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Map | MapType.MapToTarget)]
|
||||
[AdaptTo("[name]SDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Projection)]
|
||||
[GenerateMapper]
|
||||
public class Customer : ApiEntity
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
namespace Netina.Domain.Entities.Users;
|
||||
|
||||
[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget)]
|
||||
[AdaptTo("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Projection)]
|
||||
[AdaptTwoWays("[name]SDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Map | MapType.MapToTarget)]
|
||||
[AdaptTo("[name]SDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Projection)]
|
||||
[GenerateMapper]
|
||||
public class Manager : ApiEntity
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
namespace Netina.Domain.Entities.Users;
|
||||
|
||||
[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget)]
|
||||
[AdaptTo("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Projection)]
|
||||
[AdaptTwoWays("[name]SDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Map | MapType.MapToTarget)]
|
||||
[AdaptTo("[name]SDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Projection)]
|
||||
[GenerateMapper]
|
||||
public class Marketer : ApiEntity
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
namespace Netina.Domain.Entities.Users;
|
||||
|
||||
[AdaptTwoWays("[name]LDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
|
||||
[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget)]
|
||||
[AdaptTo("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Projection)]
|
||||
[AdaptTwoWays("[name]LDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
|
||||
[AdaptTwoWays("[name]SDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Map | MapType.MapToTarget)]
|
||||
[AdaptTo("[name]SDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Projection)]
|
||||
[GenerateMapper]
|
||||
public partial class NewsletterMember : ApiEntity
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
namespace Netina.Domain.Entities.Users;
|
||||
|
||||
[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget)]
|
||||
[AdaptTo("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Projection)]
|
||||
[AdaptTwoWays("[name]SDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Map | MapType.MapToTarget)]
|
||||
[AdaptTo("[name]SDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Projection)]
|
||||
[GenerateMapper]
|
||||
public partial class UserAddress : ApiEntity
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
namespace Netina.Domain.Entities.Warehouses;
|
||||
[AdaptTwoWays("[name]LDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
|
||||
[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget)]
|
||||
[AdaptTo("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Projection)]
|
||||
[AdaptTwoWays("[name]LDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
|
||||
[AdaptTwoWays("[name]SDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Map | MapType.MapToTarget)]
|
||||
[AdaptTo("[name]SDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Projection)]
|
||||
[GenerateMapper]
|
||||
public partial class Shipping : ApiEntity
|
||||
{
|
||||
|
|
|
@ -30,247 +30,265 @@ namespace Netina.Domain.Mappers
|
|||
Id = p1.CategoryId
|
||||
},
|
||||
Files = funcMain1(p1.Files),
|
||||
MetaTags = funcMain2(p1.MetaTags),
|
||||
AuthorId = p1.AuthorId,
|
||||
Author = new ApplicationUser() {Id = p1.AuthorId},
|
||||
Id = p1.Id,
|
||||
CreatedAt = p1.CreatedAt
|
||||
};
|
||||
}
|
||||
public static Blog AdaptTo(this BlogLDto p3, Blog p4)
|
||||
public static Blog AdaptTo(this BlogLDto p4, Blog p5)
|
||||
{
|
||||
if (p3 == null)
|
||||
if (p4 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
Blog result = p4 ?? new Blog();
|
||||
Blog result = p5 ?? new Blog();
|
||||
|
||||
result.Title = p3.Title;
|
||||
result.Content = p3.Content;
|
||||
result.Slug = p3.Slug;
|
||||
result.Tags = p3.Tags;
|
||||
result.ReadingTime = p3.ReadingTime;
|
||||
result.Summery = p3.Summery;
|
||||
result.IsSuggested = p3.IsSuggested;
|
||||
result.CategoryId = p3.CategoryId;
|
||||
result.Category = funcMain2(new Never(), result.Category, p3);
|
||||
result.Files = funcMain3(p3.Files, result.Files);
|
||||
result.AuthorId = p3.AuthorId;
|
||||
result.Author = funcMain4(new Never(), result.Author, p3);
|
||||
result.Id = p3.Id;
|
||||
result.CreatedAt = p3.CreatedAt;
|
||||
result.Title = p4.Title;
|
||||
result.Content = p4.Content;
|
||||
result.Slug = p4.Slug;
|
||||
result.Tags = p4.Tags;
|
||||
result.ReadingTime = p4.ReadingTime;
|
||||
result.Summery = p4.Summery;
|
||||
result.IsSuggested = p4.IsSuggested;
|
||||
result.CategoryId = p4.CategoryId;
|
||||
result.Category = funcMain3(new Never(), result.Category, p4);
|
||||
result.Files = funcMain4(p4.Files, result.Files);
|
||||
result.MetaTags = funcMain5(p4.MetaTags, result.MetaTags);
|
||||
result.AuthorId = p4.AuthorId;
|
||||
result.Author = funcMain6(new Never(), result.Author, p4);
|
||||
result.Id = p4.Id;
|
||||
result.CreatedAt = p4.CreatedAt;
|
||||
return result;
|
||||
|
||||
}
|
||||
public static Expression<Func<BlogLDto, Blog>> ProjectToBlog => p11 => new Blog()
|
||||
public static Expression<Func<BlogLDto, Blog>> ProjectToBlog => p14 => new Blog()
|
||||
{
|
||||
Title = p11.Title,
|
||||
Content = p11.Content,
|
||||
Slug = p11.Slug,
|
||||
Tags = p11.Tags,
|
||||
ReadingTime = p11.ReadingTime,
|
||||
Summery = p11.Summery,
|
||||
IsSuggested = p11.IsSuggested,
|
||||
CategoryId = p11.CategoryId,
|
||||
Title = p14.Title,
|
||||
Content = p14.Content,
|
||||
Slug = p14.Slug,
|
||||
Tags = p14.Tags,
|
||||
ReadingTime = p14.ReadingTime,
|
||||
Summery = p14.Summery,
|
||||
IsSuggested = p14.IsSuggested,
|
||||
CategoryId = p14.CategoryId,
|
||||
Category = new BlogCategory()
|
||||
{
|
||||
Name = p11.CategoryName,
|
||||
Id = p11.CategoryId
|
||||
Name = p14.CategoryName,
|
||||
Id = p14.CategoryId
|
||||
},
|
||||
Files = p11.Files.Select<StorageFileSDto, BlogStorageFile>(p12 => new BlogStorageFile()
|
||||
Files = p14.Files.Select<StorageFileSDto, BlogStorageFile>(p15 => new BlogStorageFile()
|
||||
{
|
||||
Name = p12.Name,
|
||||
FileLocation = p12.FileLocation,
|
||||
FileName = p12.FileName,
|
||||
IsHeader = p12.IsHeader,
|
||||
IsPrimary = p12.IsPrimary,
|
||||
FileType = p12.FileType,
|
||||
Id = p12.Id,
|
||||
CreatedAt = p12.CreatedAt
|
||||
Name = p15.Name,
|
||||
FileLocation = p15.FileLocation,
|
||||
FileName = p15.FileName,
|
||||
IsHeader = p15.IsHeader,
|
||||
IsPrimary = p15.IsPrimary,
|
||||
FileType = p15.FileType,
|
||||
Id = p15.Id,
|
||||
CreatedAt = p15.CreatedAt
|
||||
}).ToList<BlogStorageFile>(),
|
||||
AuthorId = p11.AuthorId,
|
||||
Author = new ApplicationUser() {Id = p11.AuthorId},
|
||||
Id = p11.Id,
|
||||
CreatedAt = p11.CreatedAt
|
||||
};
|
||||
public static BlogLDto AdaptToLDto(this Blog p13)
|
||||
{
|
||||
return p13 == null ? null : new BlogLDto()
|
||||
MetaTags = p14.MetaTags.Select<MetaTagSDto, BlogMetaTag>(p16 => new BlogMetaTag()
|
||||
{
|
||||
Title = p13.Title,
|
||||
Content = p13.Content,
|
||||
Tags = p13.Tags,
|
||||
Slug = p13.Slug,
|
||||
ReadingTime = p13.ReadingTime,
|
||||
Summery = p13.Summery,
|
||||
MainImage = p13.Files.Count > 0 && p13.Files.Any<BlogStorageFile>(funcMain5) ? p13.Files.FirstOrDefault<BlogStorageFile>(funcMain6).FileName : string.Empty,
|
||||
IsSuggested = p13.IsSuggested,
|
||||
CategoryId = p13.CategoryId,
|
||||
CategoryName = p13.Category == null ? null : p13.Category.Name,
|
||||
AuthorId = p13.AuthorId,
|
||||
AuthorFullName = p13.Author != null ? p13.Author.FirstName + " " + p13.Author.LastName : string.Empty,
|
||||
Files = funcMain7(p13.Files),
|
||||
Id = p13.Id,
|
||||
CreatedAt = p13.CreatedAt
|
||||
Type = p16.Type,
|
||||
Value = p16.Value,
|
||||
Id = p16.Id,
|
||||
CreatedAt = p16.CreatedAt
|
||||
}).ToList<BlogMetaTag>(),
|
||||
AuthorId = p14.AuthorId,
|
||||
Author = new ApplicationUser() {Id = p14.AuthorId},
|
||||
Id = p14.Id,
|
||||
CreatedAt = p14.CreatedAt
|
||||
};
|
||||
public static BlogLDto AdaptToLDto(this Blog p17)
|
||||
{
|
||||
return p17 == null ? null : new BlogLDto()
|
||||
{
|
||||
Title = p17.Title,
|
||||
Content = p17.Content,
|
||||
Tags = p17.Tags,
|
||||
Slug = p17.Slug,
|
||||
ReadingTime = p17.ReadingTime,
|
||||
Summery = p17.Summery,
|
||||
MainImage = p17.Files.Count > 0 && p17.Files.Any<BlogStorageFile>(funcMain7) ? p17.Files.FirstOrDefault<BlogStorageFile>(funcMain8).FileName : string.Empty,
|
||||
IsSuggested = p17.IsSuggested,
|
||||
CategoryId = p17.CategoryId,
|
||||
CategoryName = p17.Category == null ? null : p17.Category.Name,
|
||||
AuthorId = p17.AuthorId,
|
||||
AuthorFullName = p17.Author != null ? p17.Author.FirstName + " " + p17.Author.LastName : string.Empty,
|
||||
MetaTags = funcMain9(p17.MetaTags),
|
||||
Files = funcMain10(p17.Files),
|
||||
Id = p17.Id,
|
||||
CreatedAt = p17.CreatedAt
|
||||
};
|
||||
}
|
||||
public static BlogLDto AdaptTo(this Blog p15, BlogLDto p16)
|
||||
public static BlogLDto AdaptTo(this Blog p20, BlogLDto p21)
|
||||
{
|
||||
if (p15 == null)
|
||||
if (p20 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
BlogLDto result = p16 ?? new BlogLDto();
|
||||
BlogLDto result = p21 ?? new BlogLDto();
|
||||
|
||||
result.Title = p15.Title;
|
||||
result.Content = p15.Content;
|
||||
result.Tags = p15.Tags;
|
||||
result.Slug = p15.Slug;
|
||||
result.ReadingTime = p15.ReadingTime;
|
||||
result.Summery = p15.Summery;
|
||||
result.MainImage = p15.Files.Count > 0 && p15.Files.Any<BlogStorageFile>(funcMain5) ? p15.Files.FirstOrDefault<BlogStorageFile>(funcMain6).FileName : string.Empty;
|
||||
result.IsSuggested = p15.IsSuggested;
|
||||
result.CategoryId = p15.CategoryId;
|
||||
result.CategoryName = p15.Category == null ? null : p15.Category.Name;
|
||||
result.AuthorId = p15.AuthorId;
|
||||
result.AuthorFullName = p15.Author != null ? p15.Author.FirstName + " " + p15.Author.LastName : string.Empty;
|
||||
result.Files = funcMain8(p15.Files, result.Files);
|
||||
result.Id = p15.Id;
|
||||
result.CreatedAt = p15.CreatedAt;
|
||||
result.Title = p20.Title;
|
||||
result.Content = p20.Content;
|
||||
result.Tags = p20.Tags;
|
||||
result.Slug = p20.Slug;
|
||||
result.ReadingTime = p20.ReadingTime;
|
||||
result.Summery = p20.Summery;
|
||||
result.MainImage = p20.Files.Count > 0 && p20.Files.Any<BlogStorageFile>(funcMain7) ? p20.Files.FirstOrDefault<BlogStorageFile>(funcMain8).FileName : string.Empty;
|
||||
result.IsSuggested = p20.IsSuggested;
|
||||
result.CategoryId = p20.CategoryId;
|
||||
result.CategoryName = p20.Category == null ? null : p20.Category.Name;
|
||||
result.AuthorId = p20.AuthorId;
|
||||
result.AuthorFullName = p20.Author != null ? p20.Author.FirstName + " " + p20.Author.LastName : string.Empty;
|
||||
result.MetaTags = funcMain11(p20.MetaTags, result.MetaTags);
|
||||
result.Files = funcMain12(p20.Files, result.Files);
|
||||
result.Id = p20.Id;
|
||||
result.CreatedAt = p20.CreatedAt;
|
||||
return result;
|
||||
|
||||
}
|
||||
public static Expression<Func<Blog, BlogLDto>> ProjectToLDto => p19 => new BlogLDto()
|
||||
public static Expression<Func<Blog, BlogLDto>> ProjectToLDto => p26 => new BlogLDto()
|
||||
{
|
||||
Title = p19.Title,
|
||||
Content = p19.Content,
|
||||
Tags = p19.Tags,
|
||||
Slug = p19.Slug,
|
||||
ReadingTime = p19.ReadingTime,
|
||||
Summery = p19.Summery,
|
||||
MainImage = p19.Files.Count > 0 && p19.Files.Any<BlogStorageFile>(f => f.IsPrimary) ? p19.Files.FirstOrDefault<BlogStorageFile>(f => f.IsPrimary).FileName : string.Empty,
|
||||
IsSuggested = p19.IsSuggested,
|
||||
CategoryId = p19.CategoryId,
|
||||
CategoryName = p19.Category.Name,
|
||||
AuthorId = p19.AuthorId,
|
||||
AuthorFullName = p19.Author != null ? p19.Author.FirstName + " " + p19.Author.LastName : string.Empty,
|
||||
Files = p19.Files.Select<BlogStorageFile, StorageFileSDto>(p20 => new StorageFileSDto()
|
||||
Title = p26.Title,
|
||||
Content = p26.Content,
|
||||
Tags = p26.Tags,
|
||||
Slug = p26.Slug,
|
||||
ReadingTime = p26.ReadingTime,
|
||||
Summery = p26.Summery,
|
||||
MainImage = p26.Files.Count > 0 && p26.Files.Any<BlogStorageFile>(f => f.IsPrimary) ? p26.Files.FirstOrDefault<BlogStorageFile>(f => f.IsPrimary).FileName : string.Empty,
|
||||
IsSuggested = p26.IsSuggested,
|
||||
CategoryId = p26.CategoryId,
|
||||
CategoryName = p26.Category.Name,
|
||||
AuthorId = p26.AuthorId,
|
||||
AuthorFullName = p26.Author != null ? p26.Author.FirstName + " " + p26.Author.LastName : string.Empty,
|
||||
MetaTags = p26.MetaTags.Select<BlogMetaTag, MetaTagSDto>(p27 => new MetaTagSDto()
|
||||
{
|
||||
Name = p20.Name,
|
||||
FileLocation = p20.FileLocation,
|
||||
FileName = p20.FileName,
|
||||
IsHeader = p20.IsHeader,
|
||||
IsPrimary = p20.IsPrimary,
|
||||
FileType = p20.FileType,
|
||||
Id = p20.Id
|
||||
Type = p27.Type,
|
||||
Value = p27.Value,
|
||||
Id = p27.Id,
|
||||
CreatedAt = p27.CreatedAt
|
||||
}).ToList<MetaTagSDto>(),
|
||||
Files = p26.Files.Select<BlogStorageFile, StorageFileSDto>(p28 => new StorageFileSDto()
|
||||
{
|
||||
Name = p28.Name,
|
||||
FileLocation = p28.FileLocation,
|
||||
FileName = p28.FileName,
|
||||
IsHeader = p28.IsHeader,
|
||||
IsPrimary = p28.IsPrimary,
|
||||
FileType = p28.FileType,
|
||||
Id = p28.Id
|
||||
}).ToList<StorageFileSDto>(),
|
||||
Id = p19.Id,
|
||||
CreatedAt = p19.CreatedAt
|
||||
Id = p26.Id,
|
||||
CreatedAt = p26.CreatedAt
|
||||
};
|
||||
public static Blog AdaptToBlog(this BlogSDto p21)
|
||||
public static Blog AdaptToBlog(this BlogSDto p29)
|
||||
{
|
||||
return p21 == null ? null : new Blog()
|
||||
return p29 == null ? null : new Blog()
|
||||
{
|
||||
Title = p21.Title,
|
||||
Slug = p21.Slug,
|
||||
Tags = p21.Tags,
|
||||
ReadingTime = p21.ReadingTime,
|
||||
Summery = p21.Summery,
|
||||
IsSuggested = p21.IsSuggested,
|
||||
CategoryId = p21.CategoryId,
|
||||
Title = p29.Title,
|
||||
Slug = p29.Slug,
|
||||
Tags = p29.Tags,
|
||||
ReadingTime = p29.ReadingTime,
|
||||
Summery = p29.Summery,
|
||||
IsSuggested = p29.IsSuggested,
|
||||
CategoryId = p29.CategoryId,
|
||||
Category = new BlogCategory()
|
||||
{
|
||||
Name = p21.CategoryName,
|
||||
Id = p21.CategoryId
|
||||
Name = p29.CategoryName,
|
||||
Id = p29.CategoryId
|
||||
},
|
||||
AuthorId = p21.AuthorId,
|
||||
Author = new ApplicationUser() {Id = p21.AuthorId},
|
||||
Id = p21.Id,
|
||||
CreatedAt = p21.CreatedAt,
|
||||
ModifiedAt = p21.ModifiedAt
|
||||
AuthorId = p29.AuthorId,
|
||||
Author = new ApplicationUser() {Id = p29.AuthorId},
|
||||
Id = p29.Id,
|
||||
CreatedAt = p29.CreatedAt,
|
||||
ModifiedAt = p29.ModifiedAt
|
||||
};
|
||||
}
|
||||
public static Blog AdaptTo(this BlogSDto p22, Blog p23)
|
||||
public static Blog AdaptTo(this BlogSDto p30, Blog p31)
|
||||
{
|
||||
if (p22 == null)
|
||||
if (p30 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
Blog result = p23 ?? new Blog();
|
||||
Blog result = p31 ?? new Blog();
|
||||
|
||||
result.Title = p22.Title;
|
||||
result.Slug = p22.Slug;
|
||||
result.Tags = p22.Tags;
|
||||
result.ReadingTime = p22.ReadingTime;
|
||||
result.Summery = p22.Summery;
|
||||
result.IsSuggested = p22.IsSuggested;
|
||||
result.CategoryId = p22.CategoryId;
|
||||
result.Category = funcMain9(new Never(), result.Category, p22);
|
||||
result.AuthorId = p22.AuthorId;
|
||||
result.Author = funcMain10(new Never(), result.Author, p22);
|
||||
result.Id = p22.Id;
|
||||
result.CreatedAt = p22.CreatedAt;
|
||||
result.ModifiedAt = p22.ModifiedAt;
|
||||
result.Title = p30.Title;
|
||||
result.Slug = p30.Slug;
|
||||
result.Tags = p30.Tags;
|
||||
result.ReadingTime = p30.ReadingTime;
|
||||
result.Summery = p30.Summery;
|
||||
result.IsSuggested = p30.IsSuggested;
|
||||
result.CategoryId = p30.CategoryId;
|
||||
result.Category = funcMain13(new Never(), result.Category, p30);
|
||||
result.AuthorId = p30.AuthorId;
|
||||
result.Author = funcMain14(new Never(), result.Author, p30);
|
||||
result.Id = p30.Id;
|
||||
result.CreatedAt = p30.CreatedAt;
|
||||
result.ModifiedAt = p30.ModifiedAt;
|
||||
return result;
|
||||
|
||||
}
|
||||
public static BlogSDto AdaptToSDto(this Blog p28)
|
||||
public static BlogSDto AdaptToSDto(this Blog p36)
|
||||
{
|
||||
return p28 == null ? null : new BlogSDto()
|
||||
return p36 == null ? null : new BlogSDto()
|
||||
{
|
||||
Title = p28.Title,
|
||||
Slug = p28.Slug,
|
||||
Tags = p28.Tags,
|
||||
ReadingTime = p28.ReadingTime,
|
||||
Summery = p28.Summery,
|
||||
IsSuggested = p28.IsSuggested,
|
||||
CategoryId = p28.CategoryId,
|
||||
CategoryName = p28.Category == null ? null : p28.Category.Name,
|
||||
MainImage = p28.Files.Count > 0 && p28.Files.Any<BlogStorageFile>(funcMain11) ? p28.Files.FirstOrDefault<BlogStorageFile>(funcMain12).FileName : string.Empty,
|
||||
ModifiedAt = p28.ModifiedAt,
|
||||
AuthorId = p28.AuthorId,
|
||||
Id = p28.Id,
|
||||
CreatedAt = p28.CreatedAt
|
||||
Title = p36.Title,
|
||||
Slug = p36.Slug,
|
||||
Tags = p36.Tags,
|
||||
ReadingTime = p36.ReadingTime,
|
||||
Summery = p36.Summery,
|
||||
IsSuggested = p36.IsSuggested,
|
||||
CategoryId = p36.CategoryId,
|
||||
CategoryName = p36.Category == null ? null : p36.Category.Name,
|
||||
MainImage = p36.Files.Count > 0 && p36.Files.Any<BlogStorageFile>(funcMain15) ? p36.Files.FirstOrDefault<BlogStorageFile>(funcMain16).FileName : string.Empty,
|
||||
ModifiedAt = p36.ModifiedAt,
|
||||
AuthorId = p36.AuthorId,
|
||||
Id = p36.Id,
|
||||
CreatedAt = p36.CreatedAt
|
||||
};
|
||||
}
|
||||
public static BlogSDto AdaptTo(this Blog p29, BlogSDto p30)
|
||||
public static BlogSDto AdaptTo(this Blog p37, BlogSDto p38)
|
||||
{
|
||||
if (p29 == null)
|
||||
if (p37 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
BlogSDto result = p30 ?? new BlogSDto();
|
||||
BlogSDto result = p38 ?? new BlogSDto();
|
||||
|
||||
result.Title = p29.Title;
|
||||
result.Slug = p29.Slug;
|
||||
result.Tags = p29.Tags;
|
||||
result.ReadingTime = p29.ReadingTime;
|
||||
result.Summery = p29.Summery;
|
||||
result.IsSuggested = p29.IsSuggested;
|
||||
result.CategoryId = p29.CategoryId;
|
||||
result.CategoryName = p29.Category == null ? null : p29.Category.Name;
|
||||
result.MainImage = p29.Files.Count > 0 && p29.Files.Any<BlogStorageFile>(funcMain11) ? p29.Files.FirstOrDefault<BlogStorageFile>(funcMain12).FileName : string.Empty;
|
||||
result.ModifiedAt = p29.ModifiedAt;
|
||||
result.AuthorId = p29.AuthorId;
|
||||
result.Id = p29.Id;
|
||||
result.CreatedAt = p29.CreatedAt;
|
||||
result.Title = p37.Title;
|
||||
result.Slug = p37.Slug;
|
||||
result.Tags = p37.Tags;
|
||||
result.ReadingTime = p37.ReadingTime;
|
||||
result.Summery = p37.Summery;
|
||||
result.IsSuggested = p37.IsSuggested;
|
||||
result.CategoryId = p37.CategoryId;
|
||||
result.CategoryName = p37.Category == null ? null : p37.Category.Name;
|
||||
result.MainImage = p37.Files.Count > 0 && p37.Files.Any<BlogStorageFile>(funcMain15) ? p37.Files.FirstOrDefault<BlogStorageFile>(funcMain16).FileName : string.Empty;
|
||||
result.ModifiedAt = p37.ModifiedAt;
|
||||
result.AuthorId = p37.AuthorId;
|
||||
result.Id = p37.Id;
|
||||
result.CreatedAt = p37.CreatedAt;
|
||||
return result;
|
||||
|
||||
}
|
||||
public static Expression<Func<Blog, BlogSDto>> ProjectToSDto => p31 => new BlogSDto()
|
||||
public static Expression<Func<Blog, BlogSDto>> ProjectToSDto => p39 => new BlogSDto()
|
||||
{
|
||||
Title = p31.Title,
|
||||
Slug = p31.Slug,
|
||||
Tags = p31.Tags,
|
||||
ReadingTime = p31.ReadingTime,
|
||||
Summery = p31.Summery,
|
||||
IsSuggested = p31.IsSuggested,
|
||||
CategoryId = p31.CategoryId,
|
||||
CategoryName = p31.Category.Name,
|
||||
MainImage = p31.Files.Count > 0 && p31.Files.Any<BlogStorageFile>(f => f.IsPrimary) ? p31.Files.FirstOrDefault<BlogStorageFile>(f => f.IsPrimary).FileName : string.Empty,
|
||||
ModifiedAt = p31.ModifiedAt,
|
||||
AuthorId = p31.AuthorId,
|
||||
Id = p31.Id,
|
||||
CreatedAt = p31.CreatedAt
|
||||
Title = p39.Title,
|
||||
Slug = p39.Slug,
|
||||
Tags = p39.Tags,
|
||||
ReadingTime = p39.ReadingTime,
|
||||
Summery = p39.Summery,
|
||||
IsSuggested = p39.IsSuggested,
|
||||
CategoryId = p39.CategoryId,
|
||||
CategoryName = p39.Category.Name,
|
||||
MainImage = p39.Files.Count > 0 && p39.Files.Any<BlogStorageFile>(f => f.IsPrimary) ? p39.Files.FirstOrDefault<BlogStorageFile>(f => f.IsPrimary).FileName : string.Empty,
|
||||
ModifiedAt = p39.ModifiedAt,
|
||||
AuthorId = p39.AuthorId,
|
||||
Id = p39.Id,
|
||||
CreatedAt = p39.CreatedAt
|
||||
};
|
||||
|
||||
private static List<BlogStorageFile> funcMain1(List<StorageFileSDto> p2)
|
||||
|
@ -304,30 +322,57 @@ namespace Netina.Domain.Mappers
|
|||
|
||||
}
|
||||
|
||||
private static BlogCategory funcMain2(Never p5, BlogCategory p6, BlogLDto p3)
|
||||
private static List<BlogMetaTag> funcMain2(List<MetaTagSDto> p3)
|
||||
{
|
||||
BlogCategory result = p6 ?? new BlogCategory();
|
||||
if (p3 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
List<BlogMetaTag> result = new List<BlogMetaTag>(p3.Count);
|
||||
|
||||
result.Name = p3.CategoryName;
|
||||
result.Id = p3.CategoryId;
|
||||
int i = 0;
|
||||
int len = p3.Count;
|
||||
|
||||
while (i < len)
|
||||
{
|
||||
MetaTagSDto item = p3[i];
|
||||
result.Add(item == null ? null : new BlogMetaTag()
|
||||
{
|
||||
Type = item.Type,
|
||||
Value = item.Value,
|
||||
Id = item.Id,
|
||||
CreatedAt = item.CreatedAt
|
||||
});
|
||||
i++;
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
private static List<BlogStorageFile> funcMain3(List<StorageFileSDto> p7, List<BlogStorageFile> p8)
|
||||
private static BlogCategory funcMain3(Never p6, BlogCategory p7, BlogLDto p4)
|
||||
{
|
||||
if (p7 == null)
|
||||
BlogCategory result = p7 ?? new BlogCategory();
|
||||
|
||||
result.Name = p4.CategoryName;
|
||||
result.Id = p4.CategoryId;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
private static List<BlogStorageFile> funcMain4(List<StorageFileSDto> p8, List<BlogStorageFile> p9)
|
||||
{
|
||||
if (p8 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
List<BlogStorageFile> result = new List<BlogStorageFile>(p7.Count);
|
||||
List<BlogStorageFile> result = new List<BlogStorageFile>(p8.Count);
|
||||
|
||||
int i = 0;
|
||||
int len = p7.Count;
|
||||
int len = p8.Count;
|
||||
|
||||
while (i < len)
|
||||
{
|
||||
StorageFileSDto item = p7[i];
|
||||
StorageFileSDto item = p8[i];
|
||||
result.Add(item == null ? null : new BlogStorageFile()
|
||||
{
|
||||
Name = item.Name,
|
||||
|
@ -345,39 +390,93 @@ namespace Netina.Domain.Mappers
|
|||
|
||||
}
|
||||
|
||||
private static ApplicationUser funcMain4(Never p9, ApplicationUser p10, BlogLDto p3)
|
||||
private static List<BlogMetaTag> funcMain5(List<MetaTagSDto> p10, List<BlogMetaTag> p11)
|
||||
{
|
||||
ApplicationUser result = p10 ?? new ApplicationUser();
|
||||
if (p10 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
List<BlogMetaTag> result = new List<BlogMetaTag>(p10.Count);
|
||||
|
||||
result.Id = p3.AuthorId;
|
||||
int i = 0;
|
||||
int len = p10.Count;
|
||||
|
||||
while (i < len)
|
||||
{
|
||||
MetaTagSDto item = p10[i];
|
||||
result.Add(item == null ? null : new BlogMetaTag()
|
||||
{
|
||||
Type = item.Type,
|
||||
Value = item.Value,
|
||||
Id = item.Id,
|
||||
CreatedAt = item.CreatedAt
|
||||
});
|
||||
i++;
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
private static bool funcMain5(BlogStorageFile f)
|
||||
private static ApplicationUser funcMain6(Never p12, ApplicationUser p13, BlogLDto p4)
|
||||
{
|
||||
ApplicationUser result = p13 ?? new ApplicationUser();
|
||||
|
||||
result.Id = p4.AuthorId;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
private static bool funcMain7(BlogStorageFile f)
|
||||
{
|
||||
return f.IsPrimary;
|
||||
}
|
||||
|
||||
private static bool funcMain6(BlogStorageFile f)
|
||||
private static bool funcMain8(BlogStorageFile f)
|
||||
{
|
||||
return f.IsPrimary;
|
||||
}
|
||||
|
||||
private static List<StorageFileSDto> funcMain7(List<BlogStorageFile> p14)
|
||||
private static List<MetaTagSDto> funcMain9(List<BlogMetaTag> p18)
|
||||
{
|
||||
if (p14 == null)
|
||||
if (p18 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
List<StorageFileSDto> result = new List<StorageFileSDto>(p14.Count);
|
||||
List<MetaTagSDto> result = new List<MetaTagSDto>(p18.Count);
|
||||
|
||||
int i = 0;
|
||||
int len = p14.Count;
|
||||
int len = p18.Count;
|
||||
|
||||
while (i < len)
|
||||
{
|
||||
BlogStorageFile item = p14[i];
|
||||
BlogMetaTag item = p18[i];
|
||||
result.Add(item == null ? null : new MetaTagSDto()
|
||||
{
|
||||
Type = item.Type,
|
||||
Value = item.Value,
|
||||
Id = item.Id,
|
||||
CreatedAt = item.CreatedAt
|
||||
});
|
||||
i++;
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
private static List<StorageFileSDto> funcMain10(List<BlogStorageFile> p19)
|
||||
{
|
||||
if (p19 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
List<StorageFileSDto> result = new List<StorageFileSDto>(p19.Count);
|
||||
|
||||
int i = 0;
|
||||
int len = p19.Count;
|
||||
|
||||
while (i < len)
|
||||
{
|
||||
BlogStorageFile item = p19[i];
|
||||
result.Add(item == null ? null : new StorageFileSDto()
|
||||
{
|
||||
Name = item.Name,
|
||||
|
@ -394,20 +493,47 @@ namespace Netina.Domain.Mappers
|
|||
|
||||
}
|
||||
|
||||
private static List<StorageFileSDto> funcMain8(List<BlogStorageFile> p17, List<StorageFileSDto> p18)
|
||||
private static List<MetaTagSDto> funcMain11(List<BlogMetaTag> p22, List<MetaTagSDto> p23)
|
||||
{
|
||||
if (p17 == null)
|
||||
if (p22 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
List<StorageFileSDto> result = new List<StorageFileSDto>(p17.Count);
|
||||
List<MetaTagSDto> result = new List<MetaTagSDto>(p22.Count);
|
||||
|
||||
int i = 0;
|
||||
int len = p17.Count;
|
||||
int len = p22.Count;
|
||||
|
||||
while (i < len)
|
||||
{
|
||||
BlogStorageFile item = p17[i];
|
||||
BlogMetaTag item = p22[i];
|
||||
result.Add(item == null ? null : new MetaTagSDto()
|
||||
{
|
||||
Type = item.Type,
|
||||
Value = item.Value,
|
||||
Id = item.Id,
|
||||
CreatedAt = item.CreatedAt
|
||||
});
|
||||
i++;
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
private static List<StorageFileSDto> funcMain12(List<BlogStorageFile> p24, List<StorageFileSDto> p25)
|
||||
{
|
||||
if (p24 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
List<StorageFileSDto> result = new List<StorageFileSDto>(p24.Count);
|
||||
|
||||
int i = 0;
|
||||
int len = p24.Count;
|
||||
|
||||
while (i < len)
|
||||
{
|
||||
BlogStorageFile item = p24[i];
|
||||
result.Add(item == null ? null : new StorageFileSDto()
|
||||
{
|
||||
Name = item.Name,
|
||||
|
@ -424,31 +550,31 @@ namespace Netina.Domain.Mappers
|
|||
|
||||
}
|
||||
|
||||
private static BlogCategory funcMain9(Never p24, BlogCategory p25, BlogSDto p22)
|
||||
private static BlogCategory funcMain13(Never p32, BlogCategory p33, BlogSDto p30)
|
||||
{
|
||||
BlogCategory result = p25 ?? new BlogCategory();
|
||||
BlogCategory result = p33 ?? new BlogCategory();
|
||||
|
||||
result.Name = p22.CategoryName;
|
||||
result.Id = p22.CategoryId;
|
||||
result.Name = p30.CategoryName;
|
||||
result.Id = p30.CategoryId;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
private static ApplicationUser funcMain10(Never p26, ApplicationUser p27, BlogSDto p22)
|
||||
private static ApplicationUser funcMain14(Never p34, ApplicationUser p35, BlogSDto p30)
|
||||
{
|
||||
ApplicationUser result = p27 ?? new ApplicationUser();
|
||||
ApplicationUser result = p35 ?? new ApplicationUser();
|
||||
|
||||
result.Id = p22.AuthorId;
|
||||
result.Id = p30.AuthorId;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
private static bool funcMain11(BlogStorageFile f)
|
||||
private static bool funcMain15(BlogStorageFile f)
|
||||
{
|
||||
return f.IsPrimary;
|
||||
}
|
||||
|
||||
private static bool funcMain12(BlogStorageFile f)
|
||||
private static bool funcMain16(BlogStorageFile f)
|
||||
{
|
||||
return f.IsPrimary;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
namespace Netina.Domain.Mappers
|
||||
{
|
||||
public static partial class BlogMetaTagMapper
|
||||
{
|
||||
}
|
||||
}
|
|
@ -21,184 +21,202 @@ namespace Netina.Domain.Mappers
|
|||
HasSpecialPage = p1.HasSpecialPage,
|
||||
PageUrl = p1.PageUrl,
|
||||
Files = funcMain1(p1.Files),
|
||||
MetaTags = funcMain2(p1.MetaTags),
|
||||
Id = p1.Id,
|
||||
CreatedAt = p1.CreatedAt
|
||||
};
|
||||
}
|
||||
public static Brand AdaptTo(this BrandLDto p3, Brand p4)
|
||||
public static Brand AdaptTo(this BrandLDto p4, Brand p5)
|
||||
{
|
||||
if (p3 == null)
|
||||
if (p4 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
Brand result = p4 ?? new Brand();
|
||||
Brand result = p5 ?? new Brand();
|
||||
|
||||
result.PersianName = p3.PersianName;
|
||||
result.EnglishName = p3.EnglishName;
|
||||
result.Slug = p3.Slug;
|
||||
result.Description = p3.Description;
|
||||
result.HasSpecialPage = p3.HasSpecialPage;
|
||||
result.PageUrl = p3.PageUrl;
|
||||
result.Files = funcMain2(p3.Files, result.Files);
|
||||
result.Id = p3.Id;
|
||||
result.CreatedAt = p3.CreatedAt;
|
||||
result.PersianName = p4.PersianName;
|
||||
result.EnglishName = p4.EnglishName;
|
||||
result.Slug = p4.Slug;
|
||||
result.Description = p4.Description;
|
||||
result.HasSpecialPage = p4.HasSpecialPage;
|
||||
result.PageUrl = p4.PageUrl;
|
||||
result.Files = funcMain3(p4.Files, result.Files);
|
||||
result.MetaTags = funcMain4(p4.MetaTags, result.MetaTags);
|
||||
result.Id = p4.Id;
|
||||
result.CreatedAt = p4.CreatedAt;
|
||||
return result;
|
||||
|
||||
}
|
||||
public static Expression<Func<BrandLDto, Brand>> ProjectToBrand => p7 => new Brand()
|
||||
public static Expression<Func<BrandLDto, Brand>> ProjectToBrand => p10 => new Brand()
|
||||
{
|
||||
PersianName = p7.PersianName,
|
||||
EnglishName = p7.EnglishName,
|
||||
Slug = p7.Slug,
|
||||
Description = p7.Description,
|
||||
HasSpecialPage = p7.HasSpecialPage,
|
||||
PageUrl = p7.PageUrl,
|
||||
Files = p7.Files.Select<StorageFileSDto, BrandStorageFile>(p8 => new BrandStorageFile()
|
||||
PersianName = p10.PersianName,
|
||||
EnglishName = p10.EnglishName,
|
||||
Slug = p10.Slug,
|
||||
Description = p10.Description,
|
||||
HasSpecialPage = p10.HasSpecialPage,
|
||||
PageUrl = p10.PageUrl,
|
||||
Files = p10.Files.Select<StorageFileSDto, BrandStorageFile>(p11 => new BrandStorageFile()
|
||||
{
|
||||
Name = p8.Name,
|
||||
FileLocation = p8.FileLocation,
|
||||
FileName = p8.FileName,
|
||||
IsHeader = p8.IsHeader,
|
||||
IsPrimary = p8.IsPrimary,
|
||||
FileType = p8.FileType,
|
||||
Id = p8.Id,
|
||||
CreatedAt = p8.CreatedAt
|
||||
Name = p11.Name,
|
||||
FileLocation = p11.FileLocation,
|
||||
FileName = p11.FileName,
|
||||
IsHeader = p11.IsHeader,
|
||||
IsPrimary = p11.IsPrimary,
|
||||
FileType = p11.FileType,
|
||||
Id = p11.Id,
|
||||
CreatedAt = p11.CreatedAt
|
||||
}).ToList<BrandStorageFile>(),
|
||||
Id = p7.Id,
|
||||
CreatedAt = p7.CreatedAt
|
||||
};
|
||||
public static BrandLDto AdaptToLDto(this Brand p9)
|
||||
{
|
||||
return p9 == null ? null : new BrandLDto()
|
||||
MetaTags = p10.MetaTags.Select<MetaTagSDto, BrandMetaTag>(p12 => new BrandMetaTag()
|
||||
{
|
||||
PersianName = p9.PersianName,
|
||||
EnglishName = p9.EnglishName,
|
||||
Description = p9.Description,
|
||||
HasSpecialPage = p9.HasSpecialPage,
|
||||
Slug = p9.Slug,
|
||||
PageUrl = p9.PageUrl,
|
||||
Files = funcMain3(p9.Files),
|
||||
Id = p9.Id,
|
||||
CreatedAt = p9.CreatedAt
|
||||
Type = p12.Type,
|
||||
Value = p12.Value,
|
||||
Id = p12.Id,
|
||||
CreatedAt = p12.CreatedAt
|
||||
}).ToList<BrandMetaTag>(),
|
||||
Id = p10.Id,
|
||||
CreatedAt = p10.CreatedAt
|
||||
};
|
||||
public static BrandLDto AdaptToLDto(this Brand p13)
|
||||
{
|
||||
return p13 == null ? null : new BrandLDto()
|
||||
{
|
||||
PersianName = p13.PersianName,
|
||||
EnglishName = p13.EnglishName,
|
||||
Description = p13.Description,
|
||||
HasSpecialPage = p13.HasSpecialPage,
|
||||
Slug = p13.Slug,
|
||||
PageUrl = p13.PageUrl,
|
||||
Files = funcMain5(p13.Files),
|
||||
MetaTags = funcMain6(p13.MetaTags),
|
||||
Id = p13.Id,
|
||||
CreatedAt = p13.CreatedAt
|
||||
};
|
||||
}
|
||||
public static BrandLDto AdaptTo(this Brand p11, BrandLDto p12)
|
||||
public static BrandLDto AdaptTo(this Brand p16, BrandLDto p17)
|
||||
{
|
||||
if (p11 == null)
|
||||
if (p16 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
BrandLDto result = p12 ?? new BrandLDto();
|
||||
BrandLDto result = p17 ?? new BrandLDto();
|
||||
|
||||
result.PersianName = p11.PersianName;
|
||||
result.EnglishName = p11.EnglishName;
|
||||
result.Description = p11.Description;
|
||||
result.HasSpecialPage = p11.HasSpecialPage;
|
||||
result.Slug = p11.Slug;
|
||||
result.PageUrl = p11.PageUrl;
|
||||
result.Files = funcMain4(p11.Files, result.Files);
|
||||
result.Id = p11.Id;
|
||||
result.CreatedAt = p11.CreatedAt;
|
||||
result.PersianName = p16.PersianName;
|
||||
result.EnglishName = p16.EnglishName;
|
||||
result.Description = p16.Description;
|
||||
result.HasSpecialPage = p16.HasSpecialPage;
|
||||
result.Slug = p16.Slug;
|
||||
result.PageUrl = p16.PageUrl;
|
||||
result.Files = funcMain7(p16.Files, result.Files);
|
||||
result.MetaTags = funcMain8(p16.MetaTags, result.MetaTags);
|
||||
result.Id = p16.Id;
|
||||
result.CreatedAt = p16.CreatedAt;
|
||||
return result;
|
||||
|
||||
}
|
||||
public static Expression<Func<Brand, BrandLDto>> ProjectToLDto => p15 => new BrandLDto()
|
||||
public static Expression<Func<Brand, BrandLDto>> ProjectToLDto => p22 => new BrandLDto()
|
||||
{
|
||||
PersianName = p15.PersianName,
|
||||
EnglishName = p15.EnglishName,
|
||||
Description = p15.Description,
|
||||
HasSpecialPage = p15.HasSpecialPage,
|
||||
Slug = p15.Slug,
|
||||
PageUrl = p15.PageUrl,
|
||||
Files = p15.Files.Select<BrandStorageFile, StorageFileSDto>(p16 => new StorageFileSDto()
|
||||
PersianName = p22.PersianName,
|
||||
EnglishName = p22.EnglishName,
|
||||
Description = p22.Description,
|
||||
HasSpecialPage = p22.HasSpecialPage,
|
||||
Slug = p22.Slug,
|
||||
PageUrl = p22.PageUrl,
|
||||
Files = p22.Files.Select<BrandStorageFile, StorageFileSDto>(p23 => new StorageFileSDto()
|
||||
{
|
||||
Name = p16.Name,
|
||||
FileLocation = p16.FileLocation,
|
||||
FileName = p16.FileName,
|
||||
IsHeader = p16.IsHeader,
|
||||
IsPrimary = p16.IsPrimary,
|
||||
FileType = p16.FileType,
|
||||
Id = p16.Id
|
||||
Name = p23.Name,
|
||||
FileLocation = p23.FileLocation,
|
||||
FileName = p23.FileName,
|
||||
IsHeader = p23.IsHeader,
|
||||
IsPrimary = p23.IsPrimary,
|
||||
FileType = p23.FileType,
|
||||
Id = p23.Id
|
||||
}).ToList<StorageFileSDto>(),
|
||||
Id = p15.Id,
|
||||
CreatedAt = p15.CreatedAt
|
||||
MetaTags = p22.MetaTags.Select<BrandMetaTag, MetaTagSDto>(p24 => new MetaTagSDto()
|
||||
{
|
||||
Type = p24.Type,
|
||||
Value = p24.Value,
|
||||
Id = p24.Id,
|
||||
CreatedAt = p24.CreatedAt
|
||||
}).ToList<MetaTagSDto>(),
|
||||
Id = p22.Id,
|
||||
CreatedAt = p22.CreatedAt
|
||||
};
|
||||
public static Brand AdaptToBrand(this BrandSDto p17)
|
||||
public static Brand AdaptToBrand(this BrandSDto p25)
|
||||
{
|
||||
return p17 == null ? null : new Brand()
|
||||
return p25 == null ? null : new Brand()
|
||||
{
|
||||
PersianName = p17.PersianName,
|
||||
EnglishName = p17.EnglishName,
|
||||
Slug = p17.Slug,
|
||||
Description = p17.Description,
|
||||
HasSpecialPage = p17.HasSpecialPage,
|
||||
PageUrl = p17.PageUrl,
|
||||
Id = p17.Id,
|
||||
CreatedAt = p17.CreatedAt
|
||||
PersianName = p25.PersianName,
|
||||
EnglishName = p25.EnglishName,
|
||||
Slug = p25.Slug,
|
||||
Description = p25.Description,
|
||||
HasSpecialPage = p25.HasSpecialPage,
|
||||
PageUrl = p25.PageUrl,
|
||||
Id = p25.Id,
|
||||
CreatedAt = p25.CreatedAt
|
||||
};
|
||||
}
|
||||
public static Brand AdaptTo(this BrandSDto p18, Brand p19)
|
||||
public static Brand AdaptTo(this BrandSDto p26, Brand p27)
|
||||
{
|
||||
if (p18 == null)
|
||||
if (p26 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
Brand result = p19 ?? new Brand();
|
||||
Brand result = p27 ?? new Brand();
|
||||
|
||||
result.PersianName = p18.PersianName;
|
||||
result.EnglishName = p18.EnglishName;
|
||||
result.Slug = p18.Slug;
|
||||
result.Description = p18.Description;
|
||||
result.HasSpecialPage = p18.HasSpecialPage;
|
||||
result.PageUrl = p18.PageUrl;
|
||||
result.Id = p18.Id;
|
||||
result.CreatedAt = p18.CreatedAt;
|
||||
result.PersianName = p26.PersianName;
|
||||
result.EnglishName = p26.EnglishName;
|
||||
result.Slug = p26.Slug;
|
||||
result.Description = p26.Description;
|
||||
result.HasSpecialPage = p26.HasSpecialPage;
|
||||
result.PageUrl = p26.PageUrl;
|
||||
result.Id = p26.Id;
|
||||
result.CreatedAt = p26.CreatedAt;
|
||||
return result;
|
||||
|
||||
}
|
||||
public static BrandSDto AdaptToSDto(this Brand p20)
|
||||
public static BrandSDto AdaptToSDto(this Brand p28)
|
||||
{
|
||||
return p20 == null ? null : new BrandSDto()
|
||||
return p28 == null ? null : new BrandSDto()
|
||||
{
|
||||
PersianName = p20.PersianName,
|
||||
EnglishName = p20.EnglishName,
|
||||
Description = p20.Description,
|
||||
Slug = p20.Slug,
|
||||
HasSpecialPage = p20.HasSpecialPage,
|
||||
PageUrl = p20.PageUrl,
|
||||
Id = p20.Id,
|
||||
CreatedAt = p20.CreatedAt
|
||||
PersianName = p28.PersianName,
|
||||
EnglishName = p28.EnglishName,
|
||||
Description = p28.Description,
|
||||
Slug = p28.Slug,
|
||||
HasSpecialPage = p28.HasSpecialPage,
|
||||
PageUrl = p28.PageUrl,
|
||||
Id = p28.Id,
|
||||
CreatedAt = p28.CreatedAt
|
||||
};
|
||||
}
|
||||
public static BrandSDto AdaptTo(this Brand p21, BrandSDto p22)
|
||||
public static BrandSDto AdaptTo(this Brand p29, BrandSDto p30)
|
||||
{
|
||||
if (p21 == null)
|
||||
if (p29 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
BrandSDto result = p22 ?? new BrandSDto();
|
||||
BrandSDto result = p30 ?? new BrandSDto();
|
||||
|
||||
result.PersianName = p21.PersianName;
|
||||
result.EnglishName = p21.EnglishName;
|
||||
result.Description = p21.Description;
|
||||
result.Slug = p21.Slug;
|
||||
result.HasSpecialPage = p21.HasSpecialPage;
|
||||
result.PageUrl = p21.PageUrl;
|
||||
result.Id = p21.Id;
|
||||
result.CreatedAt = p21.CreatedAt;
|
||||
result.PersianName = p29.PersianName;
|
||||
result.EnglishName = p29.EnglishName;
|
||||
result.Description = p29.Description;
|
||||
result.Slug = p29.Slug;
|
||||
result.HasSpecialPage = p29.HasSpecialPage;
|
||||
result.PageUrl = p29.PageUrl;
|
||||
result.Id = p29.Id;
|
||||
result.CreatedAt = p29.CreatedAt;
|
||||
return result;
|
||||
|
||||
}
|
||||
public static Expression<Func<Brand, BrandSDto>> ProjectToSDto => p23 => new BrandSDto()
|
||||
public static Expression<Func<Brand, BrandSDto>> ProjectToSDto => p31 => new BrandSDto()
|
||||
{
|
||||
PersianName = p23.PersianName,
|
||||
EnglishName = p23.EnglishName,
|
||||
Description = p23.Description,
|
||||
Slug = p23.Slug,
|
||||
HasSpecialPage = p23.HasSpecialPage,
|
||||
PageUrl = p23.PageUrl,
|
||||
Id = p23.Id,
|
||||
CreatedAt = p23.CreatedAt
|
||||
PersianName = p31.PersianName,
|
||||
EnglishName = p31.EnglishName,
|
||||
Description = p31.Description,
|
||||
Slug = p31.Slug,
|
||||
HasSpecialPage = p31.HasSpecialPage,
|
||||
PageUrl = p31.PageUrl,
|
||||
Id = p31.Id,
|
||||
CreatedAt = p31.CreatedAt
|
||||
};
|
||||
|
||||
private static List<BrandStorageFile> funcMain1(List<StorageFileSDto> p2)
|
||||
|
@ -232,20 +250,47 @@ namespace Netina.Domain.Mappers
|
|||
|
||||
}
|
||||
|
||||
private static List<BrandStorageFile> funcMain2(List<StorageFileSDto> p5, List<BrandStorageFile> p6)
|
||||
private static List<BrandMetaTag> funcMain2(List<MetaTagSDto> p3)
|
||||
{
|
||||
if (p5 == null)
|
||||
if (p3 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
List<BrandStorageFile> result = new List<BrandStorageFile>(p5.Count);
|
||||
List<BrandMetaTag> result = new List<BrandMetaTag>(p3.Count);
|
||||
|
||||
int i = 0;
|
||||
int len = p5.Count;
|
||||
int len = p3.Count;
|
||||
|
||||
while (i < len)
|
||||
{
|
||||
StorageFileSDto item = p5[i];
|
||||
MetaTagSDto item = p3[i];
|
||||
result.Add(item == null ? null : new BrandMetaTag()
|
||||
{
|
||||
Type = item.Type,
|
||||
Value = item.Value,
|
||||
Id = item.Id,
|
||||
CreatedAt = item.CreatedAt
|
||||
});
|
||||
i++;
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
private static List<BrandStorageFile> funcMain3(List<StorageFileSDto> p6, List<BrandStorageFile> p7)
|
||||
{
|
||||
if (p6 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
List<BrandStorageFile> result = new List<BrandStorageFile>(p6.Count);
|
||||
|
||||
int i = 0;
|
||||
int len = p6.Count;
|
||||
|
||||
while (i < len)
|
||||
{
|
||||
StorageFileSDto item = p6[i];
|
||||
result.Add(item == null ? null : new BrandStorageFile()
|
||||
{
|
||||
Name = item.Name,
|
||||
|
@ -263,20 +308,47 @@ namespace Netina.Domain.Mappers
|
|||
|
||||
}
|
||||
|
||||
private static List<StorageFileSDto> funcMain3(List<BrandStorageFile> p10)
|
||||
private static List<BrandMetaTag> funcMain4(List<MetaTagSDto> p8, List<BrandMetaTag> p9)
|
||||
{
|
||||
if (p10 == null)
|
||||
if (p8 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
List<StorageFileSDto> result = new List<StorageFileSDto>(p10.Count);
|
||||
List<BrandMetaTag> result = new List<BrandMetaTag>(p8.Count);
|
||||
|
||||
int i = 0;
|
||||
int len = p10.Count;
|
||||
int len = p8.Count;
|
||||
|
||||
while (i < len)
|
||||
{
|
||||
BrandStorageFile item = p10[i];
|
||||
MetaTagSDto item = p8[i];
|
||||
result.Add(item == null ? null : new BrandMetaTag()
|
||||
{
|
||||
Type = item.Type,
|
||||
Value = item.Value,
|
||||
Id = item.Id,
|
||||
CreatedAt = item.CreatedAt
|
||||
});
|
||||
i++;
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
private static List<StorageFileSDto> funcMain5(List<BrandStorageFile> p14)
|
||||
{
|
||||
if (p14 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
List<StorageFileSDto> result = new List<StorageFileSDto>(p14.Count);
|
||||
|
||||
int i = 0;
|
||||
int len = p14.Count;
|
||||
|
||||
while (i < len)
|
||||
{
|
||||
BrandStorageFile item = p14[i];
|
||||
result.Add(item == null ? null : new StorageFileSDto()
|
||||
{
|
||||
Name = item.Name,
|
||||
|
@ -293,20 +365,47 @@ namespace Netina.Domain.Mappers
|
|||
|
||||
}
|
||||
|
||||
private static List<StorageFileSDto> funcMain4(List<BrandStorageFile> p13, List<StorageFileSDto> p14)
|
||||
private static List<MetaTagSDto> funcMain6(List<BrandMetaTag> p15)
|
||||
{
|
||||
if (p13 == null)
|
||||
if (p15 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
List<StorageFileSDto> result = new List<StorageFileSDto>(p13.Count);
|
||||
List<MetaTagSDto> result = new List<MetaTagSDto>(p15.Count);
|
||||
|
||||
int i = 0;
|
||||
int len = p13.Count;
|
||||
int len = p15.Count;
|
||||
|
||||
while (i < len)
|
||||
{
|
||||
BrandStorageFile item = p13[i];
|
||||
BrandMetaTag item = p15[i];
|
||||
result.Add(item == null ? null : new MetaTagSDto()
|
||||
{
|
||||
Type = item.Type,
|
||||
Value = item.Value,
|
||||
Id = item.Id,
|
||||
CreatedAt = item.CreatedAt
|
||||
});
|
||||
i++;
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
private static List<StorageFileSDto> funcMain7(List<BrandStorageFile> p18, List<StorageFileSDto> p19)
|
||||
{
|
||||
if (p18 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
List<StorageFileSDto> result = new List<StorageFileSDto>(p18.Count);
|
||||
|
||||
int i = 0;
|
||||
int len = p18.Count;
|
||||
|
||||
while (i < len)
|
||||
{
|
||||
BrandStorageFile item = p18[i];
|
||||
result.Add(item == null ? null : new StorageFileSDto()
|
||||
{
|
||||
Name = item.Name,
|
||||
|
@ -322,5 +421,32 @@ namespace Netina.Domain.Mappers
|
|||
return result;
|
||||
|
||||
}
|
||||
|
||||
private static List<MetaTagSDto> funcMain8(List<BrandMetaTag> p20, List<MetaTagSDto> p21)
|
||||
{
|
||||
if (p20 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
List<MetaTagSDto> result = new List<MetaTagSDto>(p20.Count);
|
||||
|
||||
int i = 0;
|
||||
int len = p20.Count;
|
||||
|
||||
while (i < len)
|
||||
{
|
||||
BrandMetaTag item = p20[i];
|
||||
result.Add(item == null ? null : new MetaTagSDto()
|
||||
{
|
||||
Type = item.Type,
|
||||
Value = item.Value,
|
||||
Id = item.Id,
|
||||
CreatedAt = item.CreatedAt
|
||||
});
|
||||
i++;
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
namespace Netina.Domain.Mappers
|
||||
{
|
||||
public static partial class BrandMetaTagMapper
|
||||
{
|
||||
}
|
||||
}
|
|
@ -247,8 +247,8 @@ public static class ApplicationClaims
|
|||
Value = ApplicationPermission.ViewSettings,
|
||||
};
|
||||
|
||||
public static List<ClaimDto> AllClaimDtos = new List<ClaimDto>
|
||||
{
|
||||
public static List<ClaimDto> AllClaimDtos =
|
||||
[
|
||||
ViewSettings,
|
||||
ManageSettings,
|
||||
ManageScraper,
|
||||
|
@ -287,10 +287,10 @@ public static class ApplicationClaims
|
|||
ManageFiles,
|
||||
ViewFiles,
|
||||
ManageFaq
|
||||
};
|
||||
];
|
||||
|
||||
public static List<Claim> AllClaims = new List<Claim>
|
||||
{
|
||||
public static List<Claim> AllClaims =
|
||||
[
|
||||
ViewSettings.GetClaim,
|
||||
ManageSettings.GetClaim,
|
||||
ManageScraper.GetClaim,
|
||||
|
@ -329,10 +329,10 @@ public static class ApplicationClaims
|
|||
ManageFiles.GetClaim,
|
||||
ViewFiles.GetClaim,
|
||||
ManageFaq.GetClaim
|
||||
};
|
||||
];
|
||||
|
||||
public static List<Claim> CustomerClaims = new List<Claim>
|
||||
{
|
||||
public static List<Claim> CustomerClaims =
|
||||
[
|
||||
ViewBlogs.GetClaim,
|
||||
ViewBrands.GetClaim,
|
||||
ViewCategories.GetClaim,
|
||||
|
@ -340,7 +340,7 @@ public static class ApplicationClaims
|
|||
CreateOrder.GetClaim,
|
||||
ViewProducts.GetClaim,
|
||||
AddReview.GetClaim,
|
||||
ViewMineReviews.GetClaim,
|
||||
};
|
||||
ViewMineReviews.GetClaim
|
||||
];
|
||||
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
</PropertyGroup>
|
||||
|
||||
|
@ -19,7 +20,7 @@
|
|||
|
||||
<!--<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<LangVersion>10</LangVersion>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<LangVersion>latest</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ public class ModelBuilderQueryFilter
|
|||
public void AddQueryFilterToModelBuilder(ModelBuilder modelBuilder, Type type)
|
||||
{
|
||||
var method = GetType().GetMethod("RegisterQueryFilter").MakeGenericMethod(type);
|
||||
method.Invoke(this, new object[] { modelBuilder });
|
||||
method.Invoke(this, [modelBuilder]);
|
||||
}
|
||||
|
||||
public void RegisterQueryFilter<TQFilter>(ModelBuilder modelBuilder) where TQFilter : ApiEntity
|
||||
|
@ -105,7 +105,7 @@ public static class ModelBuilderExtensions
|
|||
iface.GetGenericTypeDefinition() == typeof(IEntityTypeConfiguration<>))
|
||||
{
|
||||
var applyConcreteMethod = applyGenericMethod.MakeGenericMethod(iface.GenericTypeArguments[0]);
|
||||
applyConcreteMethod.Invoke(modelBuilder, new[] { Activator.CreateInstance(type) });
|
||||
applyConcreteMethod.Invoke(modelBuilder, [Activator.CreateInstance(type)]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -167,7 +167,7 @@ public static class ModelBuilderExtensions
|
|||
type.GetMethods().FirstOrDefault(x => x.Name == "OnModelCreating");
|
||||
|
||||
if (onModelCreatingMethod != null)
|
||||
onModelCreatingMethod.Invoke(type, new object[] { builder });
|
||||
onModelCreatingMethod.Invoke(type, [builder]);
|
||||
else
|
||||
{
|
||||
// On Base Model Creating
|
||||
|
@ -179,7 +179,7 @@ public static class ModelBuilderExtensions
|
|||
if (baseOnModelCreatingMethod == null)
|
||||
continue;
|
||||
|
||||
baseOnModelCreatingMethod.Invoke(typeof(BaseType), new object[] { builder });
|
||||
baseOnModelCreatingMethod.Invoke(typeof(BaseType), [builder]);
|
||||
}
|
||||
|
||||
builderQueryFilter.AddQueryFilterToModelBuilder(builder, type);
|
||||
|
|
|
@ -11,6 +11,10 @@ public class CreateBrandCommandHandler(IRepositoryWrapper repositoryWrapper,IMar
|
|||
{
|
||||
ent.AddFile(file.Name, file.FileLocation, file.FileName, file.IsHeader, file.IsPrimary, file.FileType);
|
||||
}
|
||||
|
||||
foreach (var (key, value) in request.MetaTags)
|
||||
ent.AddMetaTag(key, value);
|
||||
|
||||
repositoryWrapper.SetRepository<Brand>().Add(ent);
|
||||
await repositoryWrapper.SaveChangesAsync(cancellationToken);
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using Netina.Domain.Entities.Brands;
|
||||
using Netina.Domain.Entities.Products;
|
||||
|
||||
namespace Netina.Repository.Handlers.Brands;
|
||||
|
||||
|
@ -15,11 +16,15 @@ public class GetBrandsQueryHandler(IRepositoryWrapper repositoryWrapper, IMediat
|
|||
{
|
||||
//var products = await _mediator.Send(new GetProductsQuery(BrandIds: null,SpecialOffer: null, Page:0, SortBy: QuerySortBy.None,CategoryId: request.CategoryId, IsActive : null),
|
||||
// cancellationToken);
|
||||
|
||||
var cats = await mediator.Send(new GetProductCategoryChildrenQuery(request.CategoryId), cancellationToken);
|
||||
|
||||
var brandGrouped = await repositoryWrapper.SetRepository<Product>()
|
||||
.TableNoTracking
|
||||
.Where(p => p.CategoryId == request.CategoryId)
|
||||
.Where(p => cats.Contains(p.CategoryId))
|
||||
.GroupBy(p=>p.BrandId)
|
||||
.ToListAsync(cancellationToken);
|
||||
|
||||
foreach (var grouping in brandGrouped)
|
||||
{
|
||||
if (grouping.Key != default)
|
||||
|
|
|
@ -30,6 +30,22 @@ public class UpdateBrandCommandHandler(IRepositoryWrapper repositoryWrapper,IMar
|
|||
newEnt.AddFile(file.Name, file.FileLocation, file.FileName, file.IsHeader, file.IsPrimary, file.FileType);
|
||||
}
|
||||
|
||||
|
||||
//Check MetaTags
|
||||
var dbMetaTags = await repositoryWrapper.SetRepository<BrandMetaTag>()
|
||||
.TableNoTracking
|
||||
.Where(f => f.BrandId == ent.Id)
|
||||
.ToListAsync(cancellationToken);
|
||||
foreach (var feature in dbMetaTags.Where(feature => request.MetaTags.Any(f => f.Key == feature.Type) == false))
|
||||
{
|
||||
repositoryWrapper.SetRepository<BrandMetaTag>()
|
||||
.Delete(feature);
|
||||
await repositoryWrapper.SaveChangesAsync(cancellationToken);
|
||||
}
|
||||
foreach (var (key, value) in request.MetaTags.Where(f => dbMetaTags.Any(dbf => dbf.Type == f.Key) == false))
|
||||
newEnt.AddMetaTag(key, value);
|
||||
|
||||
|
||||
repositoryWrapper.SetRepository<Brand>().Update(newEnt);
|
||||
await repositoryWrapper.SaveChangesAsync(cancellationToken);
|
||||
await UpdateFaqAsync(newEnt, request.Faqs, cancellationToken);
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
namespace Netina.Repository.Handlers.Products;
|
||||
|
||||
public class CreateProductCommandHandler(IRepositoryWrapper repositoryWrapper,IMartenRepositoryWrapper martenRepositoryWrapper, IMediator mediator,ICurrentUserService currentUserService)
|
||||
public class CreateProductCommandHandler(
|
||||
IRepositoryWrapper repositoryWrapper,
|
||||
IMartenRepositoryWrapper martenRepositoryWrapper,
|
||||
IMediator mediator,
|
||||
ICurrentUserService currentUserService)
|
||||
: IRequestHandler<CreateProductCommand, ProductLDto>
|
||||
{
|
||||
public async Task<ProductLDto> Handle(CreateProductCommand request, CancellationToken cancellationToken)
|
||||
|
@ -8,6 +12,7 @@ public class CreateProductCommandHandler(IRepositoryWrapper repositoryWrapper,IM
|
|||
|
||||
if (currentUserService.UserId == null)
|
||||
throw new BaseApiException(ApiResultStatusCode.UnAuthorized, "User id is wrong");
|
||||
|
||||
if (!Guid.TryParse(currentUserService.UserId, out Guid userId))
|
||||
throw new BaseApiException(ApiResultStatusCode.UnAuthorized, "User id is wrong");
|
||||
|
||||
|
@ -29,7 +34,8 @@ public class CreateProductCommandHandler(IRepositoryWrapper repositoryWrapper,IM
|
|||
ent.AddFile(file.Name, file.FileLocation, file.FileName, file.IsHeader, file.IsPrimary, file.FileType);
|
||||
}
|
||||
|
||||
|
||||
foreach (var (key, value) in request.MetaTags)
|
||||
ent.AddMetaTag(key, value);
|
||||
|
||||
repositoryWrapper.SetRepository<Product>().Add(ent);
|
||||
await repositoryWrapper.SaveChangesAsync(cancellationToken);
|
||||
|
@ -56,9 +62,6 @@ public class CreateProductCommandHandler(IRepositoryWrapper repositoryWrapper,IM
|
|||
|
||||
await UpdateFaqAsync(ent, request.Faqs, cancellationToken);
|
||||
|
||||
foreach (var (key, value) in request.MetaTags)
|
||||
ent.AddMetaTag(key, value);
|
||||
|
||||
return ent.AdaptToLDto();
|
||||
}
|
||||
|
||||
|
|
|
@ -22,15 +22,15 @@ public class GetProductsQueryHandler(
|
|||
{
|
||||
products = request.SortBy switch
|
||||
{
|
||||
QuerySortBy.Cheapest => products.OrderBy(p => p.Cost),
|
||||
QuerySortBy.MostExpensive => products.OrderByDescending(p => p.Cost),
|
||||
QuerySortBy.MostPopular => products.OrderByDescending(p => p.Rate),
|
||||
QuerySortBy.MostViewed => products.OrderByDescending(p => p.Viewed),
|
||||
QuerySortBy.Cheapest => products.OrderByDescending(p => p.IsEnable).ThenBy(p => p.Cost),
|
||||
QuerySortBy.MostExpensive => products.OrderByDescending(p => p.IsEnable).ThenByDescending(p => p.Cost),
|
||||
QuerySortBy.MostPopular => products.OrderByDescending(p => p.IsEnable).ThenByDescending(p => p.Rate),
|
||||
QuerySortBy.MostViewed => products.OrderByDescending(p => p.IsEnable).ThenByDescending(p => p.Viewed),
|
||||
_ => products
|
||||
};
|
||||
}
|
||||
else
|
||||
products = products.OrderByDescending(p => p.CreatedAt);
|
||||
products = products.OrderByDescending(p => p.IsEnable).ThenByDescending(f=>f.CreatedAt);
|
||||
|
||||
if (request.ProductName != null)
|
||||
products = products.OrderByDescending(p => EF.Functions.TrigramsSimilarity(p.PersianName, request.ProductName));
|
||||
|
|
2267
Netina.Repository/Migrations/20241210203428_AddMetaTagToBlogAndBrands.Designer.cs
generated
100644
2267
Netina.Repository/Migrations/20241210203428_AddMetaTagToBlogAndBrands.Designer.cs
generated
100644
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,95 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace NetinaShop.Repository.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddMetaTagToBlogAndBrands : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "BlogId",
|
||||
schema: "public",
|
||||
table: "MetaTags",
|
||||
type: "uuid",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "BrandId",
|
||||
schema: "public",
|
||||
table: "MetaTags",
|
||||
type: "uuid",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_MetaTags_BlogId",
|
||||
schema: "public",
|
||||
table: "MetaTags",
|
||||
column: "BlogId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_MetaTags_BrandId",
|
||||
schema: "public",
|
||||
table: "MetaTags",
|
||||
column: "BrandId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_MetaTags_Blogs_BlogId",
|
||||
schema: "public",
|
||||
table: "MetaTags",
|
||||
column: "BlogId",
|
||||
principalSchema: "public",
|
||||
principalTable: "Blogs",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_MetaTags_Brands_BrandId",
|
||||
schema: "public",
|
||||
table: "MetaTags",
|
||||
column: "BrandId",
|
||||
principalSchema: "public",
|
||||
principalTable: "Brands",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_MetaTags_Blogs_BlogId",
|
||||
schema: "public",
|
||||
table: "MetaTags");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_MetaTags_Brands_BrandId",
|
||||
schema: "public",
|
||||
table: "MetaTags");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_MetaTags_BlogId",
|
||||
schema: "public",
|
||||
table: "MetaTags");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_MetaTags_BrandId",
|
||||
schema: "public",
|
||||
table: "MetaTags");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "BlogId",
|
||||
schema: "public",
|
||||
table: "MetaTags");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "BrandId",
|
||||
schema: "public",
|
||||
table: "MetaTags");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1686,6 +1686,30 @@ namespace NetinaShop.Repository.Migrations
|
|||
b.HasDiscriminator().HasValue("ProductDiscount");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Netina.Domain.Entities.Blogs.BlogMetaTag", b =>
|
||||
{
|
||||
b.HasBaseType("Netina.Domain.Entities.Seo.MetaTag");
|
||||
|
||||
b.Property<Guid>("BlogId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasIndex("BlogId");
|
||||
|
||||
b.HasDiscriminator().HasValue("BlogMetaTag");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Netina.Domain.Entities.Brands.BrandMetaTag", b =>
|
||||
{
|
||||
b.HasBaseType("Netina.Domain.Entities.Seo.MetaTag");
|
||||
|
||||
b.Property<Guid>("BrandId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasIndex("BrandId");
|
||||
|
||||
b.HasDiscriminator().HasValue("BrandMetaTag");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Netina.Domain.Entities.ProductCategories.ProductCategoryMetaTag", b =>
|
||||
{
|
||||
b.HasBaseType("Netina.Domain.Entities.Seo.MetaTag");
|
||||
|
@ -2072,6 +2096,26 @@ namespace NetinaShop.Repository.Migrations
|
|||
b.Navigation("Product");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Netina.Domain.Entities.Blogs.BlogMetaTag", b =>
|
||||
{
|
||||
b.HasOne("Netina.Domain.Entities.Blogs.Blog", "Brand")
|
||||
.WithMany("MetaTags")
|
||||
.HasForeignKey("BlogId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.Navigation("Brand");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Netina.Domain.Entities.Brands.BrandMetaTag", b =>
|
||||
{
|
||||
b.HasOne("Netina.Domain.Entities.Brands.Brand", "Brand")
|
||||
.WithMany("MetaTags")
|
||||
.HasForeignKey("BrandId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.Navigation("Brand");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Netina.Domain.Entities.ProductCategories.ProductCategoryMetaTag", b =>
|
||||
{
|
||||
b.HasOne("Netina.Domain.Entities.ProductCategories.ProductCategory", "ProductCategory")
|
||||
|
@ -2135,6 +2179,8 @@ namespace NetinaShop.Repository.Migrations
|
|||
modelBuilder.Entity("Netina.Domain.Entities.Blogs.Blog", b =>
|
||||
{
|
||||
b.Navigation("Files");
|
||||
|
||||
b.Navigation("MetaTags");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Netina.Domain.Entities.Blogs.BlogCategory", b =>
|
||||
|
@ -2146,6 +2192,8 @@ namespace NetinaShop.Repository.Migrations
|
|||
{
|
||||
b.Navigation("Files");
|
||||
|
||||
b.Navigation("MetaTags");
|
||||
|
||||
b.Navigation("Products");
|
||||
});
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<LangVersion>latest</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<LangVersion>latest</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -45,9 +45,9 @@ var posts = JsonConvert.DeserializeObject<List<WordPressPostDto>>(json);
|
|||
if (posts == null)
|
||||
throw new Exception("Posts is null");
|
||||
|
||||
List<SeedBlogCategoryRequestDto> categories = new List<SeedBlogCategoryRequestDto>();
|
||||
List<SeedBlogCategoryRequestDto> categories = [];
|
||||
|
||||
List<WordPressPostTagDto> tags = new List<WordPressPostTagDto>();
|
||||
List<WordPressPostTagDto> tags = [];
|
||||
foreach (var taxonomy in termTaxonomies)
|
||||
{
|
||||
if (taxonomy.taxonomy == "category")
|
||||
|
@ -81,7 +81,7 @@ Console.WriteLine($"{categories.Count} BlogCategory Added Success !");
|
|||
|
||||
|
||||
//CREATE BLOG PART
|
||||
List<SeedBlogRequestDto> blogs = new List<SeedBlogRequestDto>();
|
||||
List<SeedBlogRequestDto> blogs = [];
|
||||
var random = new Random(1532);
|
||||
int postedCounter = 0;
|
||||
int postCounter = 0;
|
||||
|
@ -195,7 +195,7 @@ foreach (var wordPressPostDto in wpPosts)
|
|||
|
||||
blogs.Add(blog);
|
||||
|
||||
await RestWrapper.Instance.SeedRestApi.SeedBlogsAsync(new List<SeedBlogRequestDto> { blog },
|
||||
await RestWrapper.Instance.SeedRestApi.SeedBlogsAsync([blog],
|
||||
"kKAYskyG8xPxKnJrHkuYxub4Ao2bnz7AOmNtwDT0RaqzaG7ZvbvaP29tCrC8wJ823RczJFXOIQT2bDOec4F38A==");
|
||||
|
||||
Console.WriteLine($"{postCounter++} / {wpPosts.Count()} Blog Added Success !");
|
||||
|
|
Loading…
Reference in New Issue