Cenk-1028 avatar image
0 Votes"
Cenk-1028 asked

Automapper How to set another property if source is null


I wonder if there is a way to set Pin to Serial if Pin is null.

 CreateMap<CouponDto, Coupon>()
                 .ForMember(dest => dest.Pin, src => src.NullSubstitute("-"))
                 .ForMember(dest => dest.Serial, src => src.NullSubstitute("-"));
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

0 Answers