示例#1
0
        public async Task <Drawing> CreateDrawing(DateTime startDate)
        {
            var activeDrawing = await _drawingRepository.GetActiveAsync();

            if (activeDrawing != null)
            {
                throw new ServiceException($"Cannot create new drawing when other one is active (id: {activeDrawing.Id})!");
            }

            var drawing = Drawing.CreateDrawing(startDate);
            await _drawingRepository.AddAsync(drawing);

            await _distributedCacheService.RemoveAsync(DistributedCacheService.ACTIVE_DRAWING);

            return(drawing);
        }