Пример #1
0
        public async Task <string> CreateTimeEntryAsync(RedmineTimeEntry timeEntry)
        {
            if (timeEntry == null)
            {
                throw new ArgumentNullException(nameof(timeEntry));
            }

            var projectInternalId = await GetProjectInternalIdAsync(timeEntry.ProjectId);

            var issueInternalId = await GetIssueInternalIdAsync(timeEntry.IssueId);

            var internalTimeEntry = new TimeEntry
            {
                Project  = projectInternalId,
                Issue    = issueInternalId,
                SpentOn  = timeEntry.WorkDate,
                Hours    = Convert.ToDecimal(timeEntry.SpentTime.TotalHours),
                Comments = timeEntry.Comment
            };

            var createdEntry = await _client.Create(internalTimeEntry);

            return(createdEntry.Id.ToString());
        }