-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cb549df
commit 6facefb
Showing
7 changed files
with
82 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Entites.DTOs | ||
{ | ||
public class CategoryWithParentDTO | ||
{ | ||
public int CategoryId { get; set; } | ||
public string Name { get; set; } = null!; | ||
public string Description { get; set; } = null!; | ||
public int ParentId { get; set; } | ||
public string? ParentName { get; set; } | ||
public bool IsFeatured { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using AutoMapper; | ||
using Entites.DTOs; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Entites.MyProfilers | ||
{ | ||
public class CategoryParentProfile : Profile | ||
{ | ||
|
||
public CategoryParentProfile() | ||
{ | ||
CreateMap<Category, CategoryWithParentDTO>() | ||
.ForMember( | ||
dest => dest.CategoryId, | ||
opt => opt.MapFrom(src => src.Id) | ||
) | ||
.ForMember( | ||
dest => dest.ParentId, | ||
opt => opt.MapFrom(src => src.ParentCategoryId) | ||
) | ||
.ForMember( | ||
dest => dest.ParentName, | ||
opt => opt.MapFrom(src => src.ParentCategory.Name) | ||
); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters