public async Task <xxxContext> Handle(CreateXxxCommand request, CancellationToken cancellationToken) { xxxEntity entity = await _provider.CreateXxxEntity(request); return(new xxxContext { id = entity.id, name = entity.name }); }
public Task <xxxEntity> CreateXxxEntity(CreateXxxCommand command) { //db process xxxEntity entity = new xxxEntity { id = "a", name = "John", age = 18 }; return(Task.FromResult(entity)); }
public Task <xxxEntity> GetXxxEntity(GetXxxQuery query) { // database process //this code is sample, so it do not access database. //And return assumption object xxxEntity entity = new xxxEntity { id = "a", name = "John", age = 18 }; return(Task.FromResult(entity)); }
public async Task <xxxDto> Handle(GetXxxQuery request, CancellationToken cancellationToken) { xxxEntity entity = await _provider.GetXxxEntity(request); int age = entity.age; if (age >= 18) { return(new xxxDto { age = entity.age, status = "Adult" }); } else { return(new xxxDto { age = entity.age, status = "Child" }); } }