code refactoring
This commit is contained in:
parent
62c7a29909
commit
cd1ad0a47f
@ -69,7 +69,7 @@
|
||||
var projectCategories = new List<string>();
|
||||
foreach (var project in Projects)
|
||||
{
|
||||
projectCategories.AddRange(project.Categories);
|
||||
projectCategories.AddRange(project.CategoryList);
|
||||
}
|
||||
return projectCategories.Distinct().ToList();
|
||||
}
|
||||
|
||||
@ -10,7 +10,9 @@ namespace PortBlog.API.Models
|
||||
|
||||
public string Description { get; set; } = string.Empty;
|
||||
|
||||
public ICollection<string> Categories { get; set; } = new List<string>();
|
||||
public string Categories { get; set; } = string.Empty;
|
||||
|
||||
public ICollection<string> CategoryList { get; set; } = new List<string>();
|
||||
|
||||
public ICollection<string> Roles { get; set; } = new List<string>();
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
var projectCategories = new List<string>();
|
||||
foreach(var project in Projects)
|
||||
{
|
||||
projectCategories.AddRange(project.Categories);
|
||||
projectCategories.AddRange(project.CategoryList);
|
||||
}
|
||||
return projectCategories.Distinct().ToList();
|
||||
}
|
||||
|
||||
@ -55,8 +55,8 @@ namespace PortBlog.API.Profiles
|
||||
)
|
||||
.ForMember
|
||||
(
|
||||
dest => dest.Categories,
|
||||
src => src.MapFrom(src => !string.IsNullOrEmpty(src.Categories) ? src.Categories.Split(",", StringSplitOptions.TrimEntries | StringSplitOptions.TrimEntries).ToList() : new List<string>())
|
||||
dest => dest.CategoryList,
|
||||
src => src.MapFrom(src => !string.IsNullOrEmpty(src.Categories) ? src.Categories.Split(",", StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries).ToList() : new List<string>())
|
||||
);
|
||||
|
||||
CreateMap<Skill, SkillDto>();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user