Esempio n. 1
0
        public async Task <VisitorResponse> Update([FromBody] UpdateVisitorRequest request)
        {
            var cmd = new UpdateVisitorCommand(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);
        }
Esempio n. 2
0
        public Visitor(UpdateVisitorCommand cmd)
        {
            if (cmd == null)
            {
                throw new ArgumentNullException(nameof(cmd), "Команда не передана");
            }

            Id         = new ObjectId(cmd.Id);
            FirstName  = cmd.FirstName;
            LastName   = cmd.LastName;
            MiddleName = cmd.MiddleName;
        }
Esempio n. 3
0
 public async Task Execute(UpdateVisitorCommand cmd, CqrsContext ctx, CancellationToken cancellationToken = new CancellationToken())
 {
     var visitor = new Visitor(cmd);
     await _visitorsRepository.Update(visitor);
 }