public List <PersonViewModel> GetAllPeople() { List <PersonModel> peopleModelList = _dalModelRetriever.GetAllPeople(); List <PersonViewModel> peopleViewModelList = PersonMapper.ConvertToPersonViewModelList(peopleModelList); return(peopleViewModelList); }
public ActionResult FamilyTreePartialView(PersonViewModel node) { PersonModel selectedNode = _dalModelRetriever.GetPersonById(node.Id); List <PersonModel> peopleList = _dalModelRetriever.GetAllPeople(); selectedNode.Relatives = _familyManager.FindChildren(selectedNode, peopleList); PersonModel lastDescendant = _familyManager.GetFullFamilyTreeFromRoot(selectedNode, peopleList); ViewData["SelectedNode"] = selectedNode.Id; ViewData["LastDescendantId"] = lastDescendant.Id; return(PartialView("_FamilyTree", lastDescendant)); }
public ActionResult Edit(int id = 0) { PersonModel person = _dalModelRetriever.GetPersonById(id); List <PersonModel> people = _dalModelRetriever.GetAllPeople(); int parentCount = _familyManager.FindParents(person, people).Count; if (parentCount == 1) { PersonModel parent = _familyManager.FindParents(person, people)[0]; ViewData["parentGender"] = parent.Gender; } ViewData["name"] = person.Name; EditViewModel editedPerson = PersonMapper.ConvertToEditViewModel(person); editedPerson.ParentCount = parentCount; return(View(editedPerson)); }