コード例 #1
0
        public async Task Increment(CourseId id)
        {
            var counter = await _repository.Search() ?? InitializeCounter();

            if (!counter.HasIncremented(id))
            {
                counter.Increment(id);

                await _repository.Save(counter);
            }
        }
コード例 #2
0
        public async Task <CoursesCounterResponse> Find()
        {
            var coursesCounter = await _repository.Search() ?? throw new CoursesCounterNotInitialized();

            return(new CoursesCounterResponse(coursesCounter.Total.Value));
        }