public void UpdateModel(ProjectFirmaModels.Models.Project project, ICollection <ProjectFirmaModels.Models.ProjectOrganization> allProjectOrganizations) { project.PrimaryContactPersonID = PrimaryContactPersonID; var projectOrganizationsUpdated = ProjectOrganizationSimples.Where(x => ModelObjectHelpers.IsRealPrimaryKeyValue(x.OrganizationID)).Select(x => new ProjectFirmaModels.Models.ProjectOrganization(project.ProjectID, x.OrganizationID, x.OrganizationRelationshipTypeID)).ToList(); project.ProjectOrganizations.Merge(projectOrganizationsUpdated, allProjectOrganizations, (x, y) => x.ProjectID == y.ProjectID && x.OrganizationID == y.OrganizationID && x.OrganizationRelationshipTypeID == y.OrganizationRelationshipTypeID, HttpRequestStorage.DatabaseEntities); project.OtherPartners = OtherPartners; }
public void UpdateModel(ProjectUpdateBatch projectUpdateBatch, List <ProjectOrganizationUpdate> currentProjectOrganizationUpdates, IList <ProjectOrganizationUpdate> allProjectOrganizationUpdates) { var projectOrganizationUpdatesUpdated = new List <ProjectOrganizationUpdate>(); if (ProjectOrganizationSimples != null) { // Completely rebuild the list projectOrganizationUpdatesUpdated = ProjectOrganizationSimples.Where(x => ModelObjectHelpers.IsRealPrimaryKeyValue(x.OrganizationID)).Select(x => x.ToProjectOrganizationUpdate(projectUpdateBatch)).ToList(); } currentProjectOrganizationUpdates.Merge(projectOrganizationUpdatesUpdated, allProjectOrganizationUpdates, (x, y) => x.ProjectUpdateBatchID == y.ProjectUpdateBatchID && x.OrganizationID == y.OrganizationID && x.RelationshipTypeID == y.RelationshipTypeID); }
public void UpdateModel(ProjectUpdateBatch projectUpdateBatch, List <ProjectOrganizationUpdate> currentProjectOrganizationUpdates, IList <ProjectOrganizationUpdate> allProjectOrganizationUpdates) { projectUpdateBatch.ProjectUpdate.PrimaryContactPersonID = PrimaryContactPersonID; var projectOrganizationUpdatesUpdated = new List <ProjectOrganizationUpdate>(); if (ProjectOrganizationSimples != null) { // Completely rebuild the list projectOrganizationUpdatesUpdated = ProjectOrganizationSimples.Where(x => ModelObjectHelpers.IsRealPrimaryKeyValue(x.OrganizationID)).Select(x => x.ToProjectOrganizationUpdate(projectUpdateBatch)).ToList(); } currentProjectOrganizationUpdates.Merge(projectOrganizationUpdatesUpdated, allProjectOrganizationUpdates, (x, y) => x.ProjectUpdateBatchID == y.ProjectUpdateBatchID && x.OrganizationID == y.OrganizationID && x.OrganizationRelationshipTypeID == y.OrganizationRelationshipTypeID, HttpRequestStorage.DatabaseEntities); }