public async Task HandleAsync(CreateOccurrenceActivityRecord command)
        {
            var forActivity = await _activitiesRepository.GetByIdAsync(command.ActivityId);

            var activityRecord = await _activityRecordCreator.CreateAsync(command.Id, forActivity, command.DayRecordId, null);

            _activityRecordsRepository.Add(activityRecord);

            await _lifeLogContext.SaveChangesAsync();
        }
コード例 #2
0
        public async Task HandleAsync(CreateTimeActivityRecord command)
        {
            var forActivity = await _activitiesRepository.GetByIdAsync(command.ActivityId);

            var time           = new TimeValue(command.Hours, command.Minutes, command.Seconds);
            var activityRecord = await _activityRecordCreator.CreateAsync(command.Id, forActivity, command.DayRecordId, time);

            _activityRecordsRepository.Add(activityRecord);

            await _lifeLogContext.SaveChangesAsync();
        }
コード例 #3
0
        public async Task HandleAsync(CreateClockActivityRecord command)
        {
            var forActivity = await _activitiesRepository.GetByIdAsync(command.ActivityId);

            var clock          = new ClockValue(command.Hour, command.Minute);
            var activityRecord = await _activityRecordCreator.CreateAsync(command.Id, forActivity, command.DayRecordId, clock);

            _activityRecordsRepository.Add(activityRecord);

            await _lifeLogContext.SaveChangesAsync();
        }
コード例 #4
0
        public async Task HandleAsync(CreateQuantityActivityRecord command)
        {
            var forActivity = await _activitiesRepository.GetByIdAsync(command.ActivityId);

            var quantity       = new QuantityValue(command.Quantity);
            var activityRecord = await _activityRecordCreator.CreateAsync(command.Id, forActivity, command.DayRecordId, quantity);

            _activityRecordsRepository.Add(activityRecord);

            await _lifeLogContext.SaveChangesAsync();
        }