public async Task <Story> UpdateStoryAsync(Story story)
        {
            var path = string.Format("/projects/{0}/stories/{1}", story.ProjectId, story.Id);
            var s    = new StoryXmlRequest
            {
                current_state = story.CurrentState.ToString().ToLowerInvariant(),
                description   = story.Description,
                name          = story.Name,
                owned_by      = story.OwnedBy,
                story_type    = story.Type.ToString().ToLowerInvariant(),
                requested_by  = story.RequestedBy,
            };

            if (story.Estimate > 0)
            {
                s.estimate = story.Estimate;
            }

            var e = await this.RequestPivotalAsync <StoryXmlResponse>(path, s, "PUT");

            return(CreateStory(e));
        }
Example #2
0
        public Story UpdateStory(Story story)
        {
            var path = string.Format("/projects/{0}/stories/{1}", story.ProjectId, story.Id);
            var s    = new StoryXmlRequest
            {
                current_state = story.CurrentState.ToString().ToLowerInvariant(),
                description   = story.Description,
                labels        = story.Labels.Count == 0 ? "" : story.Labels.Aggregate((a, b) => a + b),
                name          = story.Name,
                owned_by      = story.OwnedBy,
                story_type    = story.Type.ToString().ToLowerInvariant(),
                requested_by  = story.RequestedBy,
            };

            if (story.Estimate > 0)
            {
                s.estimate = story.Estimate;
            }

            var e = this.RequestPivotal <StoryXmlResponse>(path, s, "PUT");

            return(CreateStory(e));
        }
        public Story UpdateStory(Story story)
        {
            var path = string.Format("/projects/{0}/stories/{1}", story.ProjectId, story.Id);
            var s = new StoryXmlRequest
                        {
                            current_state = story.CurrentState.ToString().ToLowerInvariant(),
                            description = story.Description,
                            labels = story.Labels.Count == 0 ? "" : story.Labels.Aggregate((a, b) => a+b),
                            name = story.Name,
                            owned_by = story.OwnedBy,
                            story_type = story.Type.ToString().ToLowerInvariant(),
                            requested_by = story.RequestedBy,
                        };
            if (story.Estimate > 0)
                s.estimate = story.Estimate;

            var e = this.RequestPivotal<StoryXmlResponse>(path, s, "PUT");
            return CreateStory(e);
        }
		public Story UpdateStory(Story story, bool isBugAndChoresEstimables)
		{
			var path = string.Format("/projects/{0}/stories/{1}", story.ProjectId, story.Id);
			var s = new StoryXmlRequest
						{
							current_state = story.CurrentState.ToString().ToLowerInvariant(),
							description = story.Description,
							labels = story.Labels.Count == 0 ? "" : story.Labels.Aggregate((a, b) => a + ", " + b),
							name = story.Name,
							owned_by = story.OwnedBy,
							story_type = story.Type.ToString().ToLowerInvariant(),
							requested_by = story.RequestedBy,
						};

			// Check if we should set an estimate
			if (story.Estimate >= -1)
			{
				switch (story.Type)
				{
					case StoryTypeEnum.Chore:
					case StoryTypeEnum.Bug:
						if (isBugAndChoresEstimables)
							s.estimate = story.Estimate;
						else
							s.estimate = -1;
						break;

					default:
						s.estimate = story.Estimate;
						break;
				}
			}


			var e = this.RequestPivotal<StoryXmlResponse>(path, s, "PUT");
			return CreateStory(e);

		}