private void Update(Core.Entities.Sprint sprint, EditSprintRequest request) { sprint.Name = request.Name; sprint.Goal = request.Goal; sprint.TimeSpan = request.TimeSpan; sprint.Documents = request.Documents; }
public ConfirmationResponse Execute(EditSprintRequest request) { request.ThrowExceptionIfInvalid(); var sprint = _sprintRepository.Read(request.Id); Update(sprint, request); var backlog = _sprintRepository.ReadSprintBacklog(sprint.Id); var removedStories = backlog.Stories.Except(request.Stories); backlog.Stories = request.Stories.ToList(); var projectBacklog = _projectRepository.ReadProductBacklog(sprint.ProjectId); foreach (var story in removedStories) { projectBacklog.UpdateTask(new ProductBacklog.WorkTaskWithStatus(story, ProductBacklog.WorkTaskStatus.Ready)); } foreach (var story in request.Stories) { projectBacklog.UpdateTask(new ProductBacklog.WorkTaskWithStatus(story, ProductBacklog.WorkTaskStatus.InSprint)); } _sprintRepository.Update(sprint); _sprintRepository.UpdatePlannedTasks(backlog); _projectRepository.UpdateProductBacklog(projectBacklog); return(new ConfirmationResponse("Sprint updated successfully.") { Id = request.Id, }); }
public SuccessResponse PutSprint(EditSprintRequest sprint) { var result = _editValidator.Validate(sprint, ruleSet: "*"); if (!result.IsValid) { foreach (var failure in result.Errors) { return(new SuccessResponse { Message = failure.PropertyName + " failed validation." + failure.ErrorMessage }); } } var newSprint = _mapper.Map <Sprint>(sprint); _sprintLogic.EditSprint(newSprint); return(new SuccessResponse { Message = "Sprint Edited Succesfully" }); }