public ActionResult UpdateAChild(Int64 childID) { ChildDO childObject = dataAccess.ViewChildById(childID); ChildPO mappedData = Mapper.MapChildDOToPO(childObject); return(View(mappedData)); }
public ActionResult UpdateAChild(ChildPO form) { ActionResult result = null; if (ModelState.IsValid) { ChildDO mappedData = Mapper.MapChildPOToDO(form); dataAccess.UpdateAChild(mappedData); result = RedirectToAction("ViewAllChildren", "Child"); } else { result = View(); } return(result); }
public static ChildDO MapChildPOToDO(ChildPO child) { ChildDO returnDO = new ChildDO(); returnDO.ChildID = child.ChildID; returnDO.FirstName = child.FirstName; returnDO.LastName = child.LastName; returnDO.Age = child.Age; returnDO.IsFemale = child.IsFemale; returnDO.IsPottyTrained = child.IsPottyTrianed; returnDO.Allergies = child.Allergies; returnDO.Medicine = child.Medicine; returnDO.VaccinationsUpToDate = child.VaccinationsUpToDate; returnDO.EmergencyContact = child.EmergencyContact; returnDO.EmergencyContactPhoneNumber = child.EmergencyContactPhoneNumber; returnDO.AuthorizedPeopleForPickUp = child.AuthorizedPeopleForPickUp; returnDO.ParentID = child.ParentID; return(returnDO); }
public ActionResult ViewAllChildren() { ActionResult result = null; if (Session["UserName"] != null) { List <ChildPO> childList = new List <ChildPO>(); List <ChildDO> dataObjects = dataAccess.ViewChildren(); foreach (ChildDO dataObject in dataObjects) { ChildPO mappedChild = Mapper.MapChildDOToPO(dataObject); childList.Add(mappedChild); } result = View(childList); } else { result = RedirectToAction("Login", "Account"); } return(result); }
public ChildVM() { ParentDropDown = new List <SelectListItem>(); AllChildren = new List <ChildPO>(); ChildForm = new ChildPO(); }