Exemple #1
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);
        }
        public CreateAdmissionCommand(CreateAdmissionRequest request)
        {
            if (request == null)
            {
                throw new ArgumentNullException(nameof(request), "Не переданы данные для создания");
            }

            Id          = ObjectId.GenerateNewId().ToString();
            Description = request.Description;
            Meeting     = request.Meeting;
            DateFrom    = request.DateFrom;
            Floors      = request.Floors;
            VisitorId   = request.VisitorId;
        }