public async Task <CreatePrinterCommandResponse> Handle(
            CreatePrinterCommand request,
            CancellationToken cancellationToken)
        {
            var printerDomain = _mapper.Map <Printer>(request.Printer);
            await _storageService.Create(
                printerDomain,
                cancellationToken);

            var printerDto = _mapper.Map <Dto.Response.Printer>(printerDomain);

            return(new CreatePrinterCommandResponse
            {
                Printer = printerDto
            });
        }
Example #2
0
        public async Task InitialiseAsync(CancellationToken cancellationToken)
        {
            var systemInfo = await _configurationDataStorageService.Get(cancellationToken);

            if (systemInfo.Count == 0)
            {
                var newSystemInfo = new Configuration();
                await _configurationDataStorageService.Create(
                    newSystemInfo,
                    cancellationToken);

                Configuration = newSystemInfo;
            }
            else
            {
                Configuration = systemInfo[0];
            }

            Reset();
        }