Exemplo n.º 1
0
        public HttpResponseMessage Update(JObject moveTaskParams)
        {
            dynamic json     = moveTaskParams;
            string  data     = Convert.ToString(json.data);
            var     response = Request.CreateResponse();

            if (json.boardId == null)
            {
                response.StatusCode = HttpStatusCode.BadRequest;
            }
            ProjectBoards ProjectBoard = repo.GetBoard(json);

            ProjectBoard = repo.UpdateBoard(json);

            List <ProjectColumnViewModel> ProjectColumns = new List <ProjectColumnViewModel>();

            foreach (var Column in ProjectBoard.ProjectColumns)
            {
                ProjectColumns.Add(new ProjectColumnViewModel {
                    ColumnId = Column.ColumnId, Description = Column.Description, Name = Column.Name, UpdateDate = DateTime.Now, ProjectStories = Column.ProjectStories
                });
            }
            foreach (var Column in ProjectColumns)
            {
                foreach (var Story in Column.ProjectStories)
                {
                    Story.ProjectColumns = null;
                    if (Story.ProjectComments != null)
                    {
                        foreach (var Comment in Story.ProjectComments)
                        {
                            Comment.ProjectStories = null;
                        }
                    }

                    if (Story.ProjectTasks != null)
                    {
                        foreach (var Task in Story.ProjectTasks)
                        {
                            Task.ProjectStories = null;
                        }
                    }
                    if (Story.ProjectUpdates != null)
                    {
                        foreach (var Update in Story.ProjectUpdates)
                        {
                            Update.ProjectStories = null;
                        }
                    }
                }
            }
            response.StatusCode = HttpStatusCode.OK;
            response.Content    = new StringContent(JsonConvert.SerializeObject(ProjectColumns));
            return(response);
        }