public async Task <ICommandHandlerAggregateAnswer> Create(Guid personId, CreditCardDto dto) { var command = Mapper.Map(dto).OnTo(new CreditCardCreateCommand()); command.CreditCardType = CreditCardType.FromName(dto.CreditCardType); return(await dispatcher.Send <CreditCardCreateCommand, Person>(command)); }
public async Task <ICommandHandlerAggregateAnswer> Update(Guid personId, CreditCardDto dto) { var command = Mapper.Map(dto).ToANew <CreditCardUpdateCommand> (cfg => cfg.Map((p, d) => CreditCardType.FromName(p.CreditCardType)).To(d => d.CreditCardType)); return(await dispatcher.Send <CreditCardUpdateCommand, Person>(command)); }