public TimeEntry Get(int id) { TimeEntry timeEntry = _timeEntryRepository.Get(id); if (timeEntry.RequestId != null) { timeEntry.SystemId = _wrmsSystemRepository.GetByRequestId(timeEntry.RequestId.Value).Id; } return(timeEntry); }
public async Task CreateTimeEntry(Guid projectId, Guid issueId, Guid timeEntryId, decimal hours, string description, DateTime dueDate, Guid userId, Guid activityId, CancellationToken cancellationToken) { var project = await _projectRepository.Get(projectId, cancellationToken); if (project == null) { throw new ProjectNotFoundException(); } var issue = await _issueRepository.Get(issueId, cancellationToken); if (issue == null) { throw new IssueNotFoundException(); } var user = await _userRepository.Get(userId, cancellationToken); if (user == null) { throw new UserNotFoundException(); } var activity = await _timeEntryActivityRepository.Get(activityId, cancellationToken); if (activity == null) { throw new TimeEntryActivityNotFoundException(); } var timeEntry = await _timeEntryRepository.Get(timeEntryId, cancellationToken); if (timeEntry != null) { throw new TimeEntryAlreadyExistsException(); } timeEntry = new TimeEntry(timeEntryId, hours, description, dueDate, projectId, userId, activityId); issue.AddTimeEntry(timeEntry); await _issueRepository.Save(issue); }