public async Task <object> UpdateTimeRecord(TimeRecord entity) { TimeRecord recordUpdate = await _timeRecordRepository.GetTimeRecordById(entity.Id); if (recordUpdate?.Id == 0) { throw new Exception("Time record not found"); } recordUpdate.ActivityNumber = entity.ActivityNumber; recordUpdate.UsedTime = entity.UsedTime; recordUpdate.Comments = entity.Comments; return(await _timeRecordRepository.UpdateTimeRecord(recordUpdate)); }