Remove ProfileObjStateDto and update mappings
- Deleted the `ProfileObjStateDto` class and its `States` property. - Removed mapping for `ProfileObjState` to `ProfileObjStateDto` in `MappingProfile`. - Updated `States` mapping to handle null values by converting to a list or returning an empty array. - Replaced `States` property in `ProfileObjState` with a `ToList()` method that aggregates state values.
This commit is contained in:
parent
bb29b1563a
commit
b89a69b0f3
@ -1,6 +0,0 @@
|
||||
namespace WorkFlow.Application.Dto;
|
||||
|
||||
public class ProfileObjStateDto
|
||||
{
|
||||
public IEnumerable<string?> States { get; set; } = Array.Empty<string>();
|
||||
}
|
||||
@ -12,7 +12,6 @@ public class MappingProfile : AutoMapper.Profile
|
||||
CreateMap<Config, ConfigDto>();
|
||||
CreateMap<Profile, ProfileDto>();
|
||||
CreateMap<ProfileControlsTF, ProfileControlsTFDto>();
|
||||
CreateMap<ProfileObjState, ProfileObjStateDto>();
|
||||
CreateMap<State, StateDto>();
|
||||
CreateMap<Button, ButtonDto>();
|
||||
CreateMap<ProfileObject, ObjectDto>()
|
||||
@ -20,6 +19,6 @@ public class MappingProfile : AutoMapper.Profile
|
||||
new[] { src.Headline1, src.Headline2 }))
|
||||
.ForMember(dest => dest.Sublines, opt => opt.MapFrom(src =>
|
||||
new[] { src.Subline1, src.Subline2 }))
|
||||
.ForMember(dest => dest.States, opt => opt.MapFrom(src => src.States));
|
||||
.ForMember(dest => dest.States, opt => opt.MapFrom(src => src.States != null ? src.States.ToList() : Array.Empty<string>()));
|
||||
}
|
||||
}
|
||||
@ -82,8 +82,7 @@ public class ProfileObjState
|
||||
[ForeignKey("StateId")]
|
||||
public virtual State? State1 { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public IEnumerable<string?> States => new List<string?>
|
||||
public IEnumerable<string?> ToList() => new List<string?>
|
||||
{
|
||||
State1?.IntlState, State2, State3, State4
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user