Example #1
0
        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));
        }