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()); }
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); }
protected async Task <HttpResponseMessage> AddTrigger(int groupId, RotationChangedTrigger trigger) { return(await HttpClient.PostAsJsonAsync($"/groups/{groupId}/triggers", trigger, _jsonSerializerOptions)); }