public async Task <IEnumerable <AdmissionResponse> > Execute(GetAdmissionsQuery cmd, CqrsContext ctx, CancellationToken cancellationToken = new CancellationToken()) { var entities = await _admissionRepository.GetAllByVisitor(new ObjectId(cmd.VisitorId)); var dtos = entities.Select(x => new AdmissionResponse(x)); return(dtos); }
public async Task <IEnumerable <AdmissionResponse> > GetAllByVisitor(string visitorId) { var query = new GetAdmissionsQuery(visitorId); var response = await _cqrsDispatcher.ExecuteQuery <GetAdmissionsQuery, IEnumerable <AdmissionResponse> >(query, null, new CancellationToken()); return(response); }