예제 #1
0
        public async Task SaveComponentsAsync(List <PostShared> postComps)
        {
            if (postComps.Count == 0)
            {
                return;
            }
            ProjectModel project = (await GetProjectsAsync()).Find(p => { return(p.Id == postComps[0].ProjectId); });

            // Prevent Sqlite: FOREIGN KEY constraint failed on remove
            DeleteAllCapabilityByProject(await GetAllCapabilitiesByProject(project));
            // Delete all old components
            DeleteAllComponentByProject(await GetAllComponentsByProject(project));
            // Update all new components
            var compos = PostToModel <ComponentModel> .ToSharedModel(postComps, project);

            ComponentSet().UpdateRange(compos);
        }
예제 #2
0
        public async Task SaveAttributesAsync(List <PostShared> postAttrs)
        {
            if (postAttrs.Count == 0)
            {
                return;
            }
            ProjectModel project = (await GetProjectsAsync()).Find(p => { return(p.Id == postAttrs[0].ProjectId); });

            // Prevent Sqlite: FOREIGN KEY constraint failed on remove
            DeleteAllCapabilityByProject(await GetAllCapabilitiesByProject(project));
            // Delete all old attributes
            DeleteAllAttributesByProject(await GetAllAttributesByProject(project));
            // Update all new attributes
            var attrs = PostToModel <AttributeModel> .ToSharedModel(postAttrs, project);

            AttributeSet().UpdateRange(attrs);
        }