Ejemplo n.º 1
0
        /// <summary>
        /// Handles the CreateServiceRequestCommand.
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns>The created ServiceRequest entity</returns>
        public Task <ServiceRequest> Handle(CreateServiceRequestCommand request, CancellationToken cancellationToken)
        {
            var serviceRequest = new ServiceRequest(request.RequestBody.BuildingCode, request.RequestBody.Description, request.RequestBody.CreatedBy);

            _logger.LogInformation("Creating Service Request - ServiceRequest: {@ServiceRequest}", serviceRequest);

            var response = _serviceRequestRepository.Create(serviceRequest);

            _logger.LogInformation("Created Service Request - ServiceRequest: {@ServiceRequest}", response);

            return(Task.FromResult(response));
        }