Exemple #1
0
        public Paint CreateOrGetPaint(Guid userId)
        {
            var painUser = _userDataService.Get(userId);

            if (painUser.PaintId != Guid.Empty)
            {
                var paint = _paintDataService.Get(painUser.PaintId);
                if (paint == null)
                {
                    throw new NotFoundException("Paint Not found.");
                }
                paint.Strokes = _strokeDataService.GetByPaintId(paint.Id);
                foreach (var stroke in paint.Strokes)
                {
                    stroke.Lines = _lineDataService.GetByStrockId(stroke.Id);
                }
                return(paint);
            }
            else
            {
                var paint = _paintDataService.Create(new Paint());
                painUser.PaintId = paint.Id;
                return(paint);
            }
        }