public static void CommitChangesToProject(ProjectUpdateBatch projectUpdateBatch, IList <ProjectPriorityLandscape> allProjectPriorityLandscapes)
        {
            var project = projectUpdateBatch.Project;
            var currentProjectPriorityLandscapes = project.ProjectPriorityLandscapes.ToList();

            currentProjectPriorityLandscapes.ForEach(projectPriorityLandscape =>
            {
                allProjectPriorityLandscapes.Remove(projectPriorityLandscape);
            });
            currentProjectPriorityLandscapes.Clear();

            if (projectUpdateBatch.ProjectPriorityLandscapeUpdates.Any())
            {
                // Completely rebuild the list
                projectUpdateBatch.ProjectPriorityLandscapeUpdates.ToList().ForEach(x =>
                {
                    var projectPriorityLandscape = new ProjectPriorityLandscape(project, x.PriorityLandscape);
                    allProjectPriorityLandscapes.Add(projectPriorityLandscape);
                });
            }

            project.NoPriorityLandscapesExplanation = projectUpdateBatch.NoPriorityLandscapesExplanation;
        }
Esempio n. 2
0
 public static void DeleteProjectPriorityLandscape(this IQueryable <ProjectPriorityLandscape> projectPriorityLandscapes, ProjectPriorityLandscape projectPriorityLandscapeToDelete)
 {
     DeleteProjectPriorityLandscape(projectPriorityLandscapes, new List <ProjectPriorityLandscape> {
         projectPriorityLandscapeToDelete
     });
 }