public ActionResult ViewAllParents() { ParentDal dataAccess = new ParentDal(); List <ParentPO> parentList = new List <ParentPO>(); List <ParentDO> dataObjects = dataAccess.ViewParents(); foreach (ParentDO dataObject in dataObjects) { ParentPO mappedParent = Mapper.MapParentDOToPO(dataObject); parentList.Add(mappedParent); } return(View(parentList)); }
public ActionResult CreateAChild() { ChildVM vm = new ChildVM(); vm.ParentDropDown.Add(new SelectListItem() { Text = "Choose a parent", Value = "0" }); foreach (ParentDO parent in parentDataAccess.ViewParents()) { vm.ParentDropDown.Add(new SelectListItem { Text = parent.FirstName + " " + parent.LastName, Value = parent.ParentID.ToString() }); } return(View(vm)); }