I am trying to convert from bool value to decimal i automapper. It works fine if i dont check for null values .But i want to check for null values and if the value is null ,let the value be null i destination else convert to decimal.Below is the ode i tied but i am getting a error.
cfg.CreateMap<sourcemodel, destinatiomodel>()
.ForMember(dest => dest.WorkhoursPerWeek != null ?
Convert.ToDecimal(dest.WorkhoursPerWeek) : null,
opts => opts.MapFrom(src => src.cstu_WorkHoursPerWeek));