public PersonModel GetPersonById(int id) { PersonModel person = new PersonModel(); var entity = _personRepository.GetById(id); person = PersonMapper.ConvertToPersonModel(entity); return(person); }
public ActionResult AddMother(ParentViewModel parent) { if (ModelState.IsValid) { PersonModel child = _dalModelRetriever.GetPersonById(parent.ChildId); parent.Gender = "Female"; PersonModel parentModel = PersonMapper.ConvertToPersonModel(parent); parent.Id = _dalModelModifier.Save(parentModel); child.MomId = parent.Id; _dalModelModifier.AddMother(child); return(Redirect("~/Home/Index")); } else { return(PartialView("_AddParents", parent)); } }