Ejemplo n.º 1
0
        public async Task HandleAsync(DeleteActivityRecord command)
        {
            var activityRecord = await _activityRecordsRepository.GetByIdAsync(command.Id);

            await _activityRecordsDeleter.DeleteAsync(activityRecord);

            await _lifeLogContext.SaveChangesAsync();
        }
        public async Task HandleAsync(ChangeActivityRecordOrder command)
        {
            var newActivityRecordOrder = new ActivityRecordOrder(command.NewOrder);

            await _activityRecordOrderChanger.ChangeOrderAsync(command.Id, newActivityRecordOrder);

            await _lifeLogContext.SaveChangesAsync();
        }
        public async Task HandleAsync(CreateActivity command)
        {
            var activity = await _activitiesCreator.CreateAsync(command.Id, command.Name, command.Type);

            _activitiesRepository.Add(activity);

            await _lifeLogContext.SaveChangesAsync();
        }
        public async Task HandleAsync(DeleteActivity command)
        {
            var activity = await _activitiesRepository.GetByIdAsync(command.Id);

            _activitiesRepository.Remove(activity);

            await _lifeLogContext.SaveChangesAsync();
        }
Ejemplo n.º 5
0
        public async Task HandleAsync(CreateDayRecord command)
        {
            var dayRecord = await _dayRecordsCreator.CreateForDateAsync(command.Id, command.Date);

            _dayRecordsRepository.Add(dayRecord);

            await _lifeLogContext.SaveChangesAsync();
        }
        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();
        }
Ejemplo n.º 7
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();
        }
Ejemplo n.º 8
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();
        }
Ejemplo n.º 9
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();
        }