Example #1
0
        public async Task <VisitorResponse> Create([FromBody] CreateVisitorRequest request)
        {
            JsonConvert.SerializeObject(DateTime.UtcNow);
            var cmd = new CreateVisitorCommand(request);
            await _cqrsDispatcher.ExecuteCommand(cmd, null, new CancellationToken());

            var query    = new GetVisitorQuery(cmd.Id);
            var response = await _cqrsDispatcher.ExecuteQuery <GetVisitorQuery, VisitorResponse>(query, null, new CancellationToken());

            return(response);
        }
Example #2
0
        public async Task <AdmissionResponse> Create([FromBody] CreateAdmissionRequest request)
        {
            var cmd = new CreateAdmissionCommand(request);
            await _cqrsDispatcher.ExecuteCommand(cmd, null, new CancellationToken());

            var query    = new GetAdmissionQuery(request.VisitorId, cmd.Id);
            var response = await _cqrsDispatcher.ExecuteQuery <GetAdmissionQuery, AdmissionResponse>(query, null, new CancellationToken());

            return(response);
        }
Example #3
0
 public async Task AfterExecute(CreateVisitorCommand cmd, CqrsContext ctx, CancellationToken cancellationToken = new CancellationToken())
 {
     var command = new CreateAdmissionCommand(cmd);
     await _cqrsDispatcher.ExecuteCommand(command, ctx, cancellationToken);
 }