diff --git a/OutOfSchool/OutOfSchool.DataAccess/Models/Workshop.cs b/OutOfSchool/OutOfSchool.DataAccess/Models/Workshop.cs index d7383cd1a4..8ca7c9fed0 100644 --- a/OutOfSchool/OutOfSchool.DataAccess/Models/Workshop.cs +++ b/OutOfSchool/OutOfSchool.DataAccess/Models/Workshop.cs @@ -79,6 +79,9 @@ public class Workshop [MaxLength(60)] public string ProviderTitle { get; set; } = string.Empty; + [MaxLength(200)] + public string Keywords { get; set; } = string.Empty; + [Required] public bool IsPerMonth { get; set; } diff --git a/OutOfSchool/OutOfSchool.WebApi/Extensions/MappingExtensions.cs b/OutOfSchool/OutOfSchool.WebApi/Extensions/MappingExtensions.cs index ffe0d990a1..fcafbf0b71 100644 --- a/OutOfSchool/OutOfSchool.WebApi/Extensions/MappingExtensions.cs +++ b/OutOfSchool/OutOfSchool.WebApi/Extensions/MappingExtensions.cs @@ -1,4 +1,6 @@ using System; +using System.Collections.Generic; +using System.Linq; using AutoMapper; using OutOfSchool.Services.Models; using OutOfSchool.WebApi.Models; @@ -116,7 +118,8 @@ public static WorkshopDTO ToModel(this Workshop workshop) { return Mapper(workshop, cfg => { - cfg.CreateMap(); + cfg.CreateMap() + .ForMember(dest => dest.Keywords, opt => opt.MapFrom(src => src.Keywords.Split('¤', StringSplitOptions.None))); cfg.CreateMap(); cfg.CreateMap(); cfg.CreateMap(); @@ -247,7 +250,8 @@ public static Workshop ToDomain(this WorkshopDTO workshopDto) { return Mapper(workshopDto, cfg => { - cfg.CreateMap(); + cfg.CreateMap() + .ForMember(dest => dest.Keywords, opt => opt.MapFrom(src => string.Join('¤', src.Keywords.Distinct()))); cfg.CreateMap(); cfg.CreateMap(); cfg.CreateMap(); diff --git a/OutOfSchool/OutOfSchool.WebApi/Models/WorkshopDTO.cs b/OutOfSchool/OutOfSchool.WebApi/Models/WorkshopDTO.cs index 69c647fae6..58593b6fff 100644 --- a/OutOfSchool/OutOfSchool.WebApi/Models/WorkshopDTO.cs +++ b/OutOfSchool/OutOfSchool.WebApi/Models/WorkshopDTO.cs @@ -78,6 +78,8 @@ public class WorkshopDTO [MaxLength(60)] public string ProviderTitle { get; set; } = string.Empty; + public IEnumerable Keywords { get; set; } = default; + [Required] public bool IsPerMonth { get; set; }