Beispiel #1
0
 public JsonResult CreateSubtast(IEnumerable <SubtaskViewModel> subtasks)
 {
     if (subtasks.Any())
     {
         var parentIssue = _jiraInteraction.GetIssue($"{Session["Key"].ToString()}-{subtasks.First().ParentId}");
         if (parentIssue != null)
         {
             var subtasksDTO = new IssueUpdateDTO();
             foreach (var subtask in subtasks)
             {
                 var task = new IssueUpdate();
                 task.fields.project.id                    = parentIssue.fields.project.id;
                 task.fields.parent.key                    = parentIssue.key;
                 task.fields.assignee.name                 = subtask.Assignee;
                 task.fields.issuetype.id                  = subtask.IssueType;
                 task.fields.customfield_11400             = (subtask.StartDate != null) ? subtask.StartDate.Value.ToString("yyyy-MM-dd") : "";
                 task.fields.timetracking.originalEstimate = calulateTime(subtask).ToString();
                 task.fields.summary     = GenerateSummary(subtask, parentIssue.fields.summary);
                 task.fields.description = string.IsNullOrWhiteSpace(subtask.Description) ? parentIssue.fields.description : subtask.Summary;
                 subtasksDTO.issueUpdates.Add(task);
             }
             var response = _jiraInteraction.CreateBulkIssue(subtasksDTO);
             return(Json(response));
         }
     }
     return(Json("500"));
 }
Beispiel #2
0
 public BulkIssueResponse CreateBulkIssue(IssueUpdateDTO issueUpdateDTO)
 {
     try
     {
         var apiResponse = PostObject <BulkIssueResponse>($"issue/bulk", issueUpdateDTO);
         return(apiResponse);
     }
     catch (Exception ex)
     {
         return(null);
     }
 }