public async Task <ActionResult <ControllerResponse <GetTimerDto> > > update(string id, UpdateTimerDto timerIn) { string userId = _httpContextAccessor.HttpContext.User.FindFirstValue(ClaimTypes.NameIdentifier).ToString(); var timer = await _timerService.getByIdAsync(id); if (timer.userId != userId) { throw new UnauthorizedAccessException("Timer don't belong to you"); } timer = _mapper.Map <UpdateTimerDto, Timer>(timerIn, timer); await _timerService.updateAsync(id, timer); return(Ok(new ControllerResponse <GetTimerDto> { data = _mapper.Map <GetTimerDto>(timer) })); }