Exemple #1
0
        public async Task <IActionResult> AddTrigger(
            [FromRoute] int groupId,
            [FromBody] RotationChangedTrigger request)
        {
            await _permissionsService.ValidateHasAccessToGroup(User.GetUserId(), groupId);

            var trigger = _mapper.Map <Groups.Domain.Triggers.RotationChangedTrigger>(request);
            await _groupService.AddTriggerOnRotationChange(groupId, trigger);

            return(Ok());
        }
Exemple #2
0
        public async Task AddTriggerOnRotationChange(int groupId, RotationChangedTrigger trigger)
        {
            if (trigger == null)
            {
                throw new ArgumentNullException(nameof(trigger));
            }

            var group = await _repository.Get(groupId);

            group.AddRotationChangedTrigger(trigger);
            await _repository.Save(group);
        }
Exemple #3
0
 protected async Task <HttpResponseMessage> AddTrigger(int groupId, RotationChangedTrigger trigger)
 {
     return(await HttpClient.PostAsJsonAsync($"/groups/{groupId}/triggers", trigger, _jsonSerializerOptions));
 }