From 559ab04d9bf94a0ee64e1943e921eda4f0048b29 Mon Sep 17 00:00:00 2001 From: "Amir.H Khademi" Date: Wed, 11 Dec 2024 00:25:26 +0330 Subject: [PATCH] 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. --- .version | 2 +- Netina.Api/Controllers/BlogController.cs | 18 +- Netina.Api/Netina.Api.csproj | 5 +- .../Configurations/ServiceExtensions.cs | 6 +- Netina.Common/Netina.Common.csproj | 15 +- Netina.Core/Models/SiteMapUIds.cs | 6 +- Netina.Core/Netina.Core.csproj | 1 + Netina.Domain/Dtos/LargDtos/BlogLDto.cs | 1 + Netina.Domain/Dtos/LargDtos/BrandLDto.cs | 1 + Netina.Domain/Entities/Accounting/Payment.cs | 6 +- .../Entities/Blogs/Blog.Aggregate.cs | 9 + Netina.Domain/Entities/Blogs/Blog.cs | 9 +- Netina.Domain/Entities/Blogs/BlogCategory.cs | 8 +- Netina.Domain/Entities/Blogs/BlogMetaTag.cs | 17 + .../Entities/Brands/Brand.Aggregate.cs | 9 + Netina.Domain/Entities/Brands/Brand.cs | 11 +- Netina.Domain/Entities/Brands/BrandMetaTag.cs | 17 + Netina.Domain/Entities/Comments/Comment.cs | 8 +- Netina.Domain/Entities/Discounts/Discount.cs | 8 +- Netina.Domain/Entities/Orders/Order.cs | 10 +- Netina.Domain/Entities/Orders/OrderProduct.cs | 4 +- .../ProductCategories/ProductCategory.cs | 12 +- Netina.Domain/Entities/Products/Product.cs | 18 +- .../Entities/Products/Specification.cs | 8 +- Netina.Domain/Entities/Seo/MetaTag.cs | 6 +- .../Entities/StorageFiles/StorageFile.cs | 6 +- .../Entities/Users/ApplicationUser.cs | 6 +- Netina.Domain/Entities/Users/Customer.cs | 4 +- Netina.Domain/Entities/Users/Manager.cs | 4 +- Netina.Domain/Entities/Users/Marketer.cs | 4 +- .../Entities/Users/NewsletterMember.cs | 6 +- Netina.Domain/Entities/Users/UserAddress.cs | 4 +- Netina.Domain/Entities/Warehouses/Shipping.cs | 6 +- Netina.Domain/Mappers/BlogMapper.g.cs | 548 ++-- Netina.Domain/Mappers/BlogMetaTagMapper.g.cs | 6 + Netina.Domain/Mappers/BrandMapper.g.cs | 402 ++- Netina.Domain/Mappers/BrandMetaTagMapper.g.cs | 6 + .../Models/Claims/ApplicationClaims.cs | 20 +- Netina.Domain/Netina.Domain.csproj | 3 +- .../Netina.Infrastructure.csproj | 1 + .../Extensions/ModelBuilderExtensions.cs | 8 +- .../Brands/CreateBrandCommandHandler.cs | 4 + .../Handlers/Brands/GetBrandsQueryHandler.cs | 7 +- .../Brands/UpdateBrandCommandHandler.cs | 16 + .../Products/CreateProductCommandHandler.cs | 13 +- .../Products/GetProductsQueryHandler.cs | 10 +- ...3428_AddMetaTagToBlogAndBrands.Designer.cs | 2267 +++++++++++++++++ ...0241210203428_AddMetaTagToBlogAndBrands.cs | 95 + .../ApplicationContextModelSnapshot.cs | 48 + Netina.Repository/Netina.Repository.csproj | 1 + .../Netina.WordPressDBConverter.csproj | 1 + .../Program.cs | 8 +- 52 files changed, 3250 insertions(+), 469 deletions(-) create mode 100644 Netina.Domain/Entities/Blogs/BlogMetaTag.cs create mode 100644 Netina.Domain/Entities/Brands/BrandMetaTag.cs create mode 100644 Netina.Domain/Mappers/BlogMetaTagMapper.g.cs create mode 100644 Netina.Domain/Mappers/BrandMetaTagMapper.g.cs create mode 100644 Netina.Repository/Migrations/20241210203428_AddMetaTagToBlogAndBrands.Designer.cs create mode 100644 Netina.Repository/Migrations/20241210203428_AddMetaTagToBlogAndBrands.cs diff --git a/.version b/.version index c77629a..15e38e1 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -1.7.20.34 \ No newline at end of file +1.10.21.36 \ No newline at end of file diff --git a/Netina.Api/Controllers/BlogController.cs b/Netina.Api/Controllers/BlogController.cs index 5932977..31a722d 100644 --- a/Netina.Api/Controllers/BlogController.cs +++ b/Netina.Api/Controllers/BlogController.cs @@ -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().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() + .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() + .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().Update(newEnt); await repositoryWrapper.SaveChangesAsync(cancellationToken); return TypedResults.Ok(); diff --git a/Netina.Api/Netina.Api.csproj b/Netina.Api/Netina.Api.csproj index e39775b..c52c490 100644 --- a/Netina.Api/Netina.Api.csproj +++ b/Netina.Api/Netina.Api.csproj @@ -6,8 +6,9 @@ enable true Linux - 1.7.20.34 - 1.7.20.34 + 1.10.21.36 + 1.10.21.36 + latest diff --git a/Netina.Api/WebFramework/Configurations/ServiceExtensions.cs b/Netina.Api/WebFramework/Configurations/ServiceExtensions.cs index 977c174..45ca537 100644 --- a/Netina.Api/WebFramework/Configurations/ServiceExtensions.cs +++ b/Netina.Api/WebFramework/Configurations/ServiceExtensions.cs @@ -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 } diff --git a/Netina.Common/Netina.Common.csproj b/Netina.Common/Netina.Common.csproj index a3069aa..e13fd24 100644 --- a/Netina.Common/Netina.Common.csproj +++ b/Netina.Common/Netina.Common.csproj @@ -1,10 +1,11 @@  - - net8.0 - enable - enable - + + net8.0 + enable + enable + latest + @@ -16,7 +17,7 @@ - + diff --git a/Netina.Core/Models/SiteMapUIds.cs b/Netina.Core/Models/SiteMapUIds.cs index 843b38f..bf4ca4a 100644 --- a/Netina.Core/Models/SiteMapUIds.cs +++ b/Netina.Core/Models/SiteMapUIds.cs @@ -7,12 +7,12 @@ public static class SiteMapUIds public const string BlogCategories = "B5FF333DC4FF4BB4A309CE3AA32CE45A"; public const string Pages = "B463B6C4CC53432C822D79934F528D3E"; - public static List AllSiteMapsUIds => new List - { + public static List AllSiteMapsUIds => + [ BlogCategories, Categories, Blogs, Brands, Pages - }; + ]; } diff --git a/Netina.Core/Netina.Core.csproj b/Netina.Core/Netina.Core.csproj index f2b5d24..d57b86a 100644 --- a/Netina.Core/Netina.Core.csproj +++ b/Netina.Core/Netina.Core.csproj @@ -4,6 +4,7 @@ net8.0 enable enable + latest diff --git a/Netina.Domain/Dtos/LargDtos/BlogLDto.cs b/Netina.Domain/Dtos/LargDtos/BlogLDto.cs index 4fc639b..b1f316b 100644 --- a/Netina.Domain/Dtos/LargDtos/BlogLDto.cs +++ b/Netina.Domain/Dtos/LargDtos/BlogLDto.cs @@ -16,5 +16,6 @@ public class BlogLDto : BaseDto public string CategoryName { get; set; } = string.Empty; public Guid AuthorId { get; set; } public string AuthorFullName { get; set; } = string.Empty; + public List MetaTags { get; set; } = new(); public List Files { get; set; } = new(); } \ No newline at end of file diff --git a/Netina.Domain/Dtos/LargDtos/BrandLDto.cs b/Netina.Domain/Dtos/LargDtos/BrandLDto.cs index 53b5fdd..b571022 100644 --- a/Netina.Domain/Dtos/LargDtos/BrandLDto.cs +++ b/Netina.Domain/Dtos/LargDtos/BrandLDto.cs @@ -10,4 +10,5 @@ public class BrandLDto : BaseDto public string PageUrl { get; set; } = string.Empty; public string HeaderFileName { get; set; } = string.Empty; public List Files { get; internal set; } = new(); + public List MetaTags { get; set; } = new(); } \ No newline at end of file diff --git a/Netina.Domain/Entities/Accounting/Payment.cs b/Netina.Domain/Entities/Accounting/Payment.cs index 9907dff..01a7250 100644 --- a/Netina.Domain/Entities/Accounting/Payment.cs +++ b/Netina.Domain/Entities/Accounting/Payment.cs @@ -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 diff --git a/Netina.Domain/Entities/Blogs/Blog.Aggregate.cs b/Netina.Domain/Entities/Blogs/Blog.Aggregate.cs index 7de2dc5..450e660 100644 --- a/Netina.Domain/Entities/Blogs/Blog.Aggregate.cs +++ b/Netina.Domain/Entities/Blogs/Blog.Aggregate.cs @@ -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) diff --git a/Netina.Domain/Entities/Blogs/Blog.cs b/Netina.Domain/Entities/Blogs/Blog.cs index f16710f..6d44aa8 100644 --- a/Netina.Domain/Entities/Blogs/Blog.cs +++ b/Netina.Domain/Entities/Blogs/Blog.cs @@ -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 Files { get; internal set; } = new(); + public List Files { get; internal set; } = []; + public List MetaTags { get; set; } = []; public Guid AuthorId { get; internal set; } public ApplicationUser? Author { get; internal set; } diff --git a/Netina.Domain/Entities/Blogs/BlogCategory.cs b/Netina.Domain/Entities/Blogs/BlogCategory.cs index a4bede6..7c0803f 100644 --- a/Netina.Domain/Entities/Blogs/BlogCategory.cs +++ b/Netina.Domain/Entities/Blogs/BlogCategory.cs @@ -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 Blogs { get; internal set; } = new(); + public List Blogs { get; internal set; } = []; } \ No newline at end of file diff --git a/Netina.Domain/Entities/Blogs/BlogMetaTag.cs b/Netina.Domain/Entities/Blogs/BlogMetaTag.cs new file mode 100644 index 0000000..a63ed78 --- /dev/null +++ b/Netina.Domain/Entities/Blogs/BlogMetaTag.cs @@ -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; } +} \ No newline at end of file diff --git a/Netina.Domain/Entities/Brands/Brand.Aggregate.cs b/Netina.Domain/Entities/Brands/Brand.Aggregate.cs index 8f70678..9f8c596 100644 --- a/Netina.Domain/Entities/Brands/Brand.Aggregate.cs +++ b/Netina.Domain/Entities/Brands/Brand.Aggregate.cs @@ -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) diff --git a/Netina.Domain/Entities/Brands/Brand.cs b/Netina.Domain/Entities/Brands/Brand.cs index ee7ca54..5c79161 100644 --- a/Netina.Domain/Entities/Brands/Brand.cs +++ b/Netina.Domain/Entities/Brands/Brand.cs @@ -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 Products { get; internal set; } = new(); - public List Files { get; internal set; } = new(); + public List Products { get; internal set; } = []; + public List Files { get; internal set; } = []; + public List MetaTags { get; set; } = []; } \ No newline at end of file diff --git a/Netina.Domain/Entities/Brands/BrandMetaTag.cs b/Netina.Domain/Entities/Brands/BrandMetaTag.cs new file mode 100644 index 0000000..3c8daf0 --- /dev/null +++ b/Netina.Domain/Entities/Brands/BrandMetaTag.cs @@ -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; } +} \ No newline at end of file diff --git a/Netina.Domain/Entities/Comments/Comment.cs b/Netina.Domain/Entities/Comments/Comment.cs index d17a185..eb1db47 100644 --- a/Netina.Domain/Entities/Comments/Comment.cs +++ b/Netina.Domain/Entities/Comments/Comment.cs @@ -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 Children { get; internal set; } = new(); + public List Children { get; internal set; } = []; public Guid UserId { get; internal set; } public ApplicationUser? User { get; internal set; } diff --git a/Netina.Domain/Entities/Discounts/Discount.cs b/Netina.Domain/Entities/Discounts/Discount.cs index f9b1452..d291bfb 100644 --- a/Netina.Domain/Entities/Discounts/Discount.cs +++ b/Netina.Domain/Entities/Discounts/Discount.cs @@ -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 Orders { get; internal set; } = new(); + public List Orders { get; internal set; } = []; } \ No newline at end of file diff --git a/Netina.Domain/Entities/Orders/Order.cs b/Netina.Domain/Entities/Orders/Order.cs index f04e554..a209da5 100644 --- a/Netina.Domain/Entities/Orders/Order.cs +++ b/Netina.Domain/Entities/Orders/Order.cs @@ -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 OrderProducts { get; internal set; } = new(); + public List OrderProducts { get; internal set; } = []; - public List Payments { get; internal set; } = new(); + public List Payments { get; internal set; } = []; } \ No newline at end of file diff --git a/Netina.Domain/Entities/Orders/OrderProduct.cs b/Netina.Domain/Entities/Orders/OrderProduct.cs index 263fa6c..c774541 100644 --- a/Netina.Domain/Entities/Orders/OrderProduct.cs +++ b/Netina.Domain/Entities/Orders/OrderProduct.cs @@ -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 { diff --git a/Netina.Domain/Entities/ProductCategories/ProductCategory.cs b/Netina.Domain/Entities/ProductCategories/ProductCategory.cs index e0690ab..cb1e8af 100644 --- a/Netina.Domain/Entities/ProductCategories/ProductCategory.cs +++ b/Netina.Domain/Entities/ProductCategories/ProductCategory.cs @@ -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 Children { get; internal set; } = new(); - public List MetaTags { get; internal set; } = new(); - public List Products { get; internal set; } = new(); - public List Files { get; internal set; } = new(); + public List MetaTags { get; internal set; } = []; + public List Products { get; internal set; } = []; + public List Files { get; internal set; } = []; } \ No newline at end of file diff --git a/Netina.Domain/Entities/Products/Product.cs b/Netina.Domain/Entities/Products/Product.cs index 6275eb8..4c38498 100644 --- a/Netina.Domain/Entities/Products/Product.cs +++ b/Netina.Domain/Entities/Products/Product.cs @@ -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 Specifications { get; internal set; } = new(); - public List Comments { get; internal set; } = new(); - public List Files { get; internal set; } = new(); + public List Specifications { get; internal set; } = []; + public List Comments { get; internal set; } = []; + public List Files { get; internal set; } = []; - public List MetaTags { get; internal set; } = new(); + public List MetaTags { get; internal set; } = []; - public List OrderProducts { get; internal set; } = new(); + public List OrderProducts { get; internal set; } = []; } \ No newline at end of file diff --git a/Netina.Domain/Entities/Products/Specification.cs b/Netina.Domain/Entities/Products/Specification.cs index 52dd2ce..429ee17 100644 --- a/Netina.Domain/Entities/Products/Specification.cs +++ b/Netina.Domain/Entities/Products/Specification.cs @@ -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 Children { get; internal set; } = new(); + public List Children { get; internal set; } = []; } \ No newline at end of file diff --git a/Netina.Domain/Entities/Seo/MetaTag.cs b/Netina.Domain/Entities/Seo/MetaTag.cs index ccaab62..ea31bd9 100644 --- a/Netina.Domain/Entities/Seo/MetaTag.cs +++ b/Netina.Domain/Entities/Seo/MetaTag.cs @@ -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 { diff --git a/Netina.Domain/Entities/StorageFiles/StorageFile.cs b/Netina.Domain/Entities/StorageFiles/StorageFile.cs index 652d038..ff1ab65 100644 --- a/Netina.Domain/Entities/StorageFiles/StorageFile.cs +++ b/Netina.Domain/Entities/StorageFiles/StorageFile.cs @@ -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 { diff --git a/Netina.Domain/Entities/Users/ApplicationUser.cs b/Netina.Domain/Entities/Users/ApplicationUser.cs index e37aa41..10246b0 100644 --- a/Netina.Domain/Entities/Users/ApplicationUser.cs +++ b/Netina.Domain/Entities/Users/ApplicationUser.cs @@ -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 @@ -13,7 +13,7 @@ public class ApplicationUser : IdentityUser public DateTime BirthDate { get; set; } public Gender Gender { get; set; } public SignUpStatus SignUpStatus { get; set; } - public List Addresses { get; set; } = new(); + public List Addresses { get; set; } = []; public Manager? Manager { get; set; } public Customer? Customer { get; set; } diff --git a/Netina.Domain/Entities/Users/Customer.cs b/Netina.Domain/Entities/Users/Customer.cs index 152ace2..54c3080 100644 --- a/Netina.Domain/Entities/Users/Customer.cs +++ b/Netina.Domain/Entities/Users/Customer.cs @@ -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 { diff --git a/Netina.Domain/Entities/Users/Manager.cs b/Netina.Domain/Entities/Users/Manager.cs index db6845f..dc9d63f 100644 --- a/Netina.Domain/Entities/Users/Manager.cs +++ b/Netina.Domain/Entities/Users/Manager.cs @@ -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 { diff --git a/Netina.Domain/Entities/Users/Marketer.cs b/Netina.Domain/Entities/Users/Marketer.cs index ac23542..565b9f7 100644 --- a/Netina.Domain/Entities/Users/Marketer.cs +++ b/Netina.Domain/Entities/Users/Marketer.cs @@ -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 { diff --git a/Netina.Domain/Entities/Users/NewsletterMember.cs b/Netina.Domain/Entities/Users/NewsletterMember.cs index 26f3cc2..f606f06 100644 --- a/Netina.Domain/Entities/Users/NewsletterMember.cs +++ b/Netina.Domain/Entities/Users/NewsletterMember.cs @@ -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 { diff --git a/Netina.Domain/Entities/Users/UserAddress.cs b/Netina.Domain/Entities/Users/UserAddress.cs index bf95af8..ce293a1 100644 --- a/Netina.Domain/Entities/Users/UserAddress.cs +++ b/Netina.Domain/Entities/Users/UserAddress.cs @@ -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 { diff --git a/Netina.Domain/Entities/Warehouses/Shipping.cs b/Netina.Domain/Entities/Warehouses/Shipping.cs index 4c09a18..4990afa 100644 --- a/Netina.Domain/Entities/Warehouses/Shipping.cs +++ b/Netina.Domain/Entities/Warehouses/Shipping.cs @@ -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 { diff --git a/Netina.Domain/Mappers/BlogMapper.g.cs b/Netina.Domain/Mappers/BlogMapper.g.cs index b204207..36af171 100644 --- a/Netina.Domain/Mappers/BlogMapper.g.cs +++ b/Netina.Domain/Mappers/BlogMapper.g.cs @@ -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> ProjectToBlog => p11 => new Blog() + public static Expression> 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(p12 => new BlogStorageFile() + Files = p14.Files.Select(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(), - 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(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(funcMain5) ? p13.Files.FirstOrDefault(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(), + 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(funcMain7) ? p17.Files.FirstOrDefault(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(funcMain5) ? p15.Files.FirstOrDefault(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(funcMain7) ? p20.Files.FirstOrDefault(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> ProjectToLDto => p19 => new BlogLDto() + public static Expression> 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(f => f.IsPrimary) ? p19.Files.FirstOrDefault(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(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(f => f.IsPrimary) ? p26.Files.FirstOrDefault(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(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(), + Files = p26.Files.Select(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(), - 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(funcMain11) ? p28.Files.FirstOrDefault(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(funcMain15) ? p36.Files.FirstOrDefault(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(funcMain11) ? p29.Files.FirstOrDefault(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(funcMain15) ? p37.Files.FirstOrDefault(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> ProjectToSDto => p31 => new BlogSDto() + public static Expression> 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(f => f.IsPrimary) ? p31.Files.FirstOrDefault(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(f => f.IsPrimary) ? p39.Files.FirstOrDefault(f => f.IsPrimary).FileName : string.Empty, + ModifiedAt = p39.ModifiedAt, + AuthorId = p39.AuthorId, + Id = p39.Id, + CreatedAt = p39.CreatedAt }; private static List funcMain1(List p2) @@ -304,30 +322,57 @@ namespace Netina.Domain.Mappers } - private static BlogCategory funcMain2(Never p5, BlogCategory p6, BlogLDto p3) + private static List funcMain2(List p3) { - BlogCategory result = p6 ?? new BlogCategory(); + if (p3 == null) + { + return null; + } + List result = new List(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 funcMain3(List p7, List 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 funcMain4(List p8, List p9) + { + if (p8 == null) { return null; } - List result = new List(p7.Count); + List result = new List(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 funcMain5(List p10, List p11) { - ApplicationUser result = p10 ?? new ApplicationUser(); + if (p10 == null) + { + return null; + } + List result = new List(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 funcMain7(List p14) + private static List funcMain9(List p18) { - if (p14 == null) + if (p18 == null) { return null; } - List result = new List(p14.Count); + List result = new List(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 funcMain10(List p19) + { + if (p19 == null) + { + return null; + } + List result = new List(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 funcMain8(List p17, List p18) + private static List funcMain11(List p22, List p23) { - if (p17 == null) + if (p22 == null) { return null; } - List result = new List(p17.Count); + List result = new List(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 funcMain12(List p24, List p25) + { + if (p24 == null) + { + return null; + } + List result = new List(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; } diff --git a/Netina.Domain/Mappers/BlogMetaTagMapper.g.cs b/Netina.Domain/Mappers/BlogMetaTagMapper.g.cs new file mode 100644 index 0000000..8d28a99 --- /dev/null +++ b/Netina.Domain/Mappers/BlogMetaTagMapper.g.cs @@ -0,0 +1,6 @@ +namespace Netina.Domain.Mappers +{ + public static partial class BlogMetaTagMapper + { + } +} \ No newline at end of file diff --git a/Netina.Domain/Mappers/BrandMapper.g.cs b/Netina.Domain/Mappers/BrandMapper.g.cs index 131a4be..a90b238 100644 --- a/Netina.Domain/Mappers/BrandMapper.g.cs +++ b/Netina.Domain/Mappers/BrandMapper.g.cs @@ -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> ProjectToBrand => p7 => new Brand() + public static Expression> 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(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(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(), - Id = p7.Id, - CreatedAt = p7.CreatedAt - }; - public static BrandLDto AdaptToLDto(this Brand p9) - { - return p9 == null ? null : new BrandLDto() + MetaTags = p10.MetaTags.Select(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(), + 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> ProjectToLDto => p15 => new BrandLDto() + public static Expression> 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(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(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(), - Id = p15.Id, - CreatedAt = p15.CreatedAt + MetaTags = p22.MetaTags.Select(p24 => new MetaTagSDto() + { + Type = p24.Type, + Value = p24.Value, + Id = p24.Id, + CreatedAt = p24.CreatedAt + }).ToList(), + 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> ProjectToSDto => p23 => new BrandSDto() + public static Expression> 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 funcMain1(List p2) @@ -232,20 +250,47 @@ namespace Netina.Domain.Mappers } - private static List funcMain2(List p5, List p6) + private static List funcMain2(List p3) { - if (p5 == null) + if (p3 == null) { return null; } - List result = new List(p5.Count); + List result = new List(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 funcMain3(List p6, List p7) + { + if (p6 == null) + { + return null; + } + List result = new List(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 funcMain3(List p10) + private static List funcMain4(List p8, List p9) { - if (p10 == null) + if (p8 == null) { return null; } - List result = new List(p10.Count); + List result = new List(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 funcMain5(List p14) + { + if (p14 == null) + { + return null; + } + List result = new List(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 funcMain4(List p13, List p14) + private static List funcMain6(List p15) { - if (p13 == null) + if (p15 == null) { return null; } - List result = new List(p13.Count); + List result = new List(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 funcMain7(List p18, List p19) + { + if (p18 == null) + { + return null; + } + List result = new List(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 funcMain8(List p20, List p21) + { + if (p20 == null) + { + return null; + } + List result = new List(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; + + } } } \ No newline at end of file diff --git a/Netina.Domain/Mappers/BrandMetaTagMapper.g.cs b/Netina.Domain/Mappers/BrandMetaTagMapper.g.cs new file mode 100644 index 0000000..ada6006 --- /dev/null +++ b/Netina.Domain/Mappers/BrandMetaTagMapper.g.cs @@ -0,0 +1,6 @@ +namespace Netina.Domain.Mappers +{ + public static partial class BrandMetaTagMapper + { + } +} \ No newline at end of file diff --git a/Netina.Domain/Models/Claims/ApplicationClaims.cs b/Netina.Domain/Models/Claims/ApplicationClaims.cs index 74842ba..ef63041 100644 --- a/Netina.Domain/Models/Claims/ApplicationClaims.cs +++ b/Netina.Domain/Models/Claims/ApplicationClaims.cs @@ -247,8 +247,8 @@ public static class ApplicationClaims Value = ApplicationPermission.ViewSettings, }; - public static List AllClaimDtos = new List - { + public static List AllClaimDtos = + [ ViewSettings, ManageSettings, ManageScraper, @@ -287,10 +287,10 @@ public static class ApplicationClaims ManageFiles, ViewFiles, ManageFaq - }; + ]; - public static List AllClaims = new List - { + public static List AllClaims = + [ ViewSettings.GetClaim, ManageSettings.GetClaim, ManageScraper.GetClaim, @@ -329,10 +329,10 @@ public static class ApplicationClaims ManageFiles.GetClaim, ViewFiles.GetClaim, ManageFaq.GetClaim - }; + ]; - public static List CustomerClaims = new List - { + public static List 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 + ]; } diff --git a/Netina.Domain/Netina.Domain.csproj b/Netina.Domain/Netina.Domain.csproj index e70fb2c..434d135 100644 --- a/Netina.Domain/Netina.Domain.csproj +++ b/Netina.Domain/Netina.Domain.csproj @@ -4,6 +4,7 @@ net8.0 enable enable + latest true @@ -19,7 +20,7 @@