Combine 2 fields in one by mapster

25 Views Asked by At

Need to combine 2 fields in one. Now I do it after mapster

public static Template FromVM(this TemplateVM inputTemplate)
 {
     // mapster
     var template = inputTemplate.AdaptToTemplate();
     // mannually
     if (inputTemplate.TaskAutocreateConditionList != null)
     {
         foreach (var additional in inputTemplate.TaskAutocreateConditionList)
         {
             var question = template.Questions.FirstOrDefault(q => q.Id == additional.QuestionId);
             if (question != null)
             {
                 question.AutoCreateTaskIfAnswer = (sbyte)additional.AnswerValue;
             }
         }
     }
     return template;
 }

Is there any way to create rule that do the same in Mapster Config file?

0

There are 0 best solutions below