//Save //AddNew //Update public void Save(HttpMap item) { var listBackups = item.Backups.Select(x => new HttpMapTypesFiles() { IdHttMap = item.Id, IdType = 1, Value = x.Url }).ToList(); var listDocuments = item.Documents.Select(x => new HttpMapTypesFiles() { IdHttMap = item.Id, IdType = 2, Value = x.ToString() }).ToList(); var listFiles = item.Files.Select(x => new HttpMapTypesFiles() { IdHttMap = item.Id, IdType = 3, Value = x.ToString() }).ToList(); var listFolders = item.Folders.Select(x => new HttpMapTypesFiles() { IdHttMap = item.Id, IdType = 4, Value = x.ToString() }).ToList(); var listParametrized = item.Parametrized.Select(x => new HttpMapTypesFiles() { IdHttMap = item.Id, IdType = 5, Value = x.ToString() }).ToList(); CurrentContextDb.HttpMapTypesFiles.AddRange(listBackups); CurrentContextDb.HttpMapTypesFiles.AddRange(listDocuments); CurrentContextDb.HttpMapTypesFiles.AddRange(listFiles); CurrentContextDb.HttpMapTypesFiles.AddRange(listFolders); CurrentContextDb.HttpMapTypesFiles.AddRange(listParametrized); CurrentContextDb.SaveChanges(); }
private Configuration LoadDefaultConfig() { var config = new Configuration { FingerPrintingAllFtp = false, FingerPrintingAllHttp = true, FingerPrintingAllSmtp = true, FingerPrintingDns = true, PassiveFingerPrintingHttp = true, PasiveFingerPrintingSmtp = true, ResolveHost = true, UseHead = true, DefaultDnsCacheSnooping = "www.google.com", GoogleApiKey = string.Empty, GoogleApiCx = string.Empty, BingApiKey = string.Empty, ShodanApiKey = string.Empty, NumberOfTasks = 15, MaxRecursion = 4, ParallelDnsQueries = 4, ProjectConfigFile = string.Empty, ScanNetranges255 = true, SelectedTechExtensions = new List <string>(), SimultaneousDownloads = 15, SPathsPlugins = string.Empty, UseAllDns = true, webSearcherEngine = 2 }; CurrentContextDb.Configurations.Add(config); CurrentContextDb.SaveChanges(); return(config); }
public void Save(ThreadSafeList <FilesITem> items) { try { if (items.Count == 0) { return; } foreach (var fileItem in items) { if (fileItem.Id == 0) { AddNew(fileItem); } else { Update(fileItem); } } CurrentContextDb.SaveChanges(); } catch (Exception ex) { throw ex; } }
/// <summary> /// Add new. /// </summary> /// <param name="item"></param> private static void AddNew(DomainsItem item) { item.IdProject = Program.data.Project.Id; CurrentContextDb.Domains.Add(item); CurrentContextDb.SaveChanges(); new HttpMapController().Save(item.map); }
public void Save(Project item) { if (item.Id != 0) { Update(item); } else { AddNew(item); } CurrentContextDb.SaveChanges(); }
//Save //AddNew //Update public void Save(ThreadSafeList <Plugin> items) { try { if (items.Count == 0) { return; } var allPlugins = CurrentContextDb.Plugins.ToList(); CurrentContextDb.Plugins.RemoveRange(allPlugins); CurrentContextDb.Plugins.AddRange(items); CurrentContextDb.SaveChanges(); } catch (Exception ex) { throw ex; } }
public void Save(ThreadSafeList <Limits> items) { if (items.Count == 0) { return; } foreach (var limitItem in items) { if (limitItem.Id == 0) { AddNew(limitItem); } else { Update(limitItem); } } CurrentContextDb.SaveChanges(); }
//Save //AddNew //Update public void Save(ThreadSafeList <ComputerDomainsItem> items) { if (items.Count == 0) { return; } foreach (var comDomainItem in items) { if (comDomainItem.Id == 0) { AddNew(comDomainItem); } else { Update(comDomainItem); } } CurrentContextDb.SaveChanges(); }
public void Save(ThreadSafeList <RelationsItem> items) { if (items.Count == 0) { return; } foreach (var relationItem in items) { if (relationItem.Id == 0) { AddNew(relationItem); } else { Update(relationItem); } } CurrentContextDb.SaveChanges(); }