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 ActionResult CreateAChild(ChildVM form) { ActionResult result = null; if (ModelState.IsValid) { ChildDO mappedData = Mapper.MapChildPOToDO(form.ChildForm); dataAccess.CreateAChild(mappedData); result = RedirectToAction("ViewAllChildren"); } else { //Re-Populate your drop down list. result = View(form); } 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); }