public async Task <ActionResult <ControllerResponse <GetProjectTaskDto> > > update(string id, UpdateProjectTaskDto projectTaskIn) { string userId = _httpContextAccessor.HttpContext.User.FindFirstValue(ClaimTypes.NameIdentifier).ToString(); var projectTask = await _projectTaskService.getByIdAsync(id); if (projectTask.userId != userId) { throw new UnauthorizedAccessException("ProjectTask don't belong to you"); } projectTask = _mapper.Map <UpdateProjectTaskDto, ProjectTask>(projectTaskIn, projectTask); await _projectTaskService.updateAsync(id, projectTask); return(Ok(new ControllerResponse <GetProjectTaskDto> { data = _mapper.Map <GetProjectTaskDto>(projectTask) })); }