public Marriage FindBySon(Person son) { var marriageSon = new MarriageSonRepository().FindBySon(son); if (marriageSon != null) { var marriage = DB.Database.GetDatabase().FetchBy<Marriage>(sql => sql.Where(x => x.id.Equals(marriageSon.marriage_id))).FirstOrDefault(); if (marriage != null) return FindMarriageData(marriage); else return null; } else { return null; } }
public string GetAllItemsAsJson() { var persons = new PersonRepository().FindAll(); var marriages = new MarriageRepository().FindAll(); var marriageSons = new MarriageSonRepository().FindAll(); int counter = 0; var personsAsJs = GetPersonsAsJsNodes( persons, ref counter); var marriagesAsJs = GetMarriagesAsJsNodes(marriages, ref counter); var nodesAsJs = new List<string>(); nodesAsJs.AddRange(personsAsJs.Select(x => x.Value.Item2)); nodesAsJs.AddRange(marriagesAsJs.Select(x => x.Value.Item2)); var linksAsJs = GetLinksAsJs(marriageSons, marriages, personsAsJs, marriagesAsJs); var fullJs = String.Format(@"{{""directed"": true, ""graph"": [], ""nodes"": [{0}] , ""links"": [{1}] , ""multigraph"": false}}", String.Join(",\r\n", nodesAsJs), String.Join(",\r\n", linksAsJs)); return fullJs; }
public Marriage FindBySon(Person son) { var marriageSon = new MarriageSonRepository().FindBySon(son); if (marriageSon != null) { var marriage = DB.Database.GetDatabase().FetchBy <Marriage>(sql => sql.Where(x => x.id.Equals(marriageSon.marriage_id))).FirstOrDefault(); if (marriage != null) { return(FindMarriageData(marriage)); } else { return(null); } } else { return(null); } }