// Prevent replicate records in the database ! public List <gitRepo> deleteRecords(List <gitRepo> remote, List <gitRepo> local) { List <gitRepo> removeL = new List <gitRepo>(); for (var i = 0; i < local.Count; i++) { gitRepo currlocal = local[i]; int currIndex = remote.BinarySearch(currlocal, this.cmpfunc); if (currIndex < 0) { removeL.Add(currlocal); } else { gitRepo curRemote = remote[currIndex]; if (!currlocal.Equals(curRemote)) { removeL.Add(currlocal); } } } return(removeL); }
// add data we get from github of each repository // check the Model for the data from the response public List <gitRepo> addRecords(List <gitRepo> remote, List <gitRepo> local) { List <gitRepo> addL = new List <gitRepo>(); for (var i = 0; i < remote.Count; i++) { gitRepo currRemote = remote[i]; int currIndex = local.BinarySearch(currRemote, this.cmpfunc); if (currIndex < 0) { addL.Add(currRemote); } else { gitRepo currlocal = local[currIndex]; if (!currRemote.Equals(currlocal)) { addL.Add(currRemote); } } } return(addL); }