public async Task AddDemoAsync(AddDemoDto dto) { var entity = new Demo(dto.Name); foreach (var item in dto.Items) { entity.AddItem(item.Name); } await _demoRepository.AddAsync(entity); }
public async Task <Guid> Handle(CreateDemoCommand request, CancellationToken cancellationToken) { var entity = await _repo.AddAsync(new DemoEntity { id = Guid.NewGuid(), property1 = request.property1, property2 = request.property2 }); return(entity.id); }