public async Task <IActionResult> UpdateHourly(int userId, int id, HourlyForCreationDto hourlyForUpdateDto) { if (userId != int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value)) { return(Unauthorized()); } var hourlyFromRepo = await _repo.GetHourly(id); _mapper.Map(hourlyForUpdateDto, hourlyFromRepo); if (await _repo.SaveAll()) { return(CreatedAtRoute("GetHourly", new { id = hourlyFromRepo.Id, userId = userId }, hourlyForUpdateDto)); } throw new Exception($"Updating hourly count {id} failed on save"); }