public bool Delete(int id) { AncestryRepository ancestryRepository = new AncestryRepository(); try { ancestryRepository.Delete(id); return(true); } catch { return(false); } }
public bool Post(AncestryModel ancestryModel) { AncestryRepository ancestryRepository = new AncestryRepository(); try { Ancestry ancestry = new Ancestry(); ancestry.Identifier = ancestryModel.Identifier; ancestryRepository.Insert(ancestry); return(true); } catch { return(false); } }
public bool Update(AncestryModel ancestryModel) { AncestryRepository ancestryRepository = new AncestryRepository(); Ancestry ancestry = new Ancestry(); try { ancestry.Id = ancestryModel.Id; ancestry.Identifier = ancestryModel.Identifier; ancestryRepository.Update(ancestry); return(true); } catch { return(false); } }
public AncestryModel GetById(int id) { AncestryRepository ancestryRepository = new AncestryRepository(); try { Ancestry ancestry = ancestryRepository.GetById(id); AncestryModel ancestryModel = new AncestryModel(); ancestryModel.Id = ancestry.Id; ancestryModel.Identifier = ancestry.Identifier; return(ancestryModel); } catch { return(null); } }
public void Test_AdvancedSearch_Descendents_WithGenderUnspecified() { var dbPath = (Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase) + @"\data_small.json").Replace(@"file:\", string.Empty); AncestryRepository ancestryRepository = new AncestryRepository(dbPath) { MaxNoOfSearchResults = 10 }; string nameContains = "Codi Clarie"; var results = ancestryRepository.AdvancedSearch(new AdvancedSearchParameters { Name = nameContains, Direction = Direction.Descendents }); Assert.IsTrue(results.SearchResults.Count() == 3); Assert.IsTrue(results.SearchResults.Last().Level == 4); }
public void Test_SimpleSearch_WithGenderUnspecified() { var dbPath = (Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase) + @"\data_small.json").Replace(@"file:\", string.Empty); AncestryRepository ancestryRepository = new AncestryRepository(dbPath) { MaxNoOfSearchResults = 10 }; string nameContains = "le"; var results = ancestryRepository.SimpleSearch(new SearchParameters { Name = nameContains }); results.SearchResults.ToList().ForEach(result => { Assert.IsTrue(result.Name.Contains(nameContains)); }); }