public ActionResult AddContactInfoForPerson(ContactTypeForPersonViewModel contactTypeForPersonViewModel) { if (ModelState.IsValid) { contactTypeForPersonViewModel.PersonContactInfo.PersonPrimaryInfoID = contactTypeForPersonViewModel.PersonPrimaryInfo.PersonPrimaryInfoID; unitOfWork.PersonContactInfoRepository.Insert(contactTypeForPersonViewModel.PersonContactInfo); unitOfWork.Save(); return RedirectToAction("Index"); } return View(SetupForAddContactInfoForPerson(contactTypeForPersonViewModel, contactTypeForPersonViewModel.PersonPrimaryInfo.PersonPrimaryInfoID)); }
public ActionResult EditContactInfoForPerson(int personPrimaryInfoID, int personContactTypeID) { ContactTypeForPersonViewModel contactTypeForPersonViewModel = new ContactTypeForPersonViewModel(); contactTypeForPersonViewModel.PersonContactInfo = unitOfWork.PersonContactInfoRepository.GetByID(personPrimaryInfoID, personContactTypeID); return View(SetupForAddContactInfoForPerson(contactTypeForPersonViewModel, personPrimaryInfoID)); }
public ActionResult AddContactInfoForPerson(int personPrimaryInfoID) { ContactTypeForPersonViewModel contactTypeForPersonViewModel = new ContactTypeForPersonViewModel(); contactTypeForPersonViewModel.PersonContactInfo = new PersonContactInfo(); return View(SetupForAddContactInfoForPerson(contactTypeForPersonViewModel, personPrimaryInfoID)); }
private ContactTypeForPersonViewModel SetupForAddContactInfoForPerson(ContactTypeForPersonViewModel contactTypeForPersonViewModel, int personPrimaryInfoID) { contactTypeForPersonViewModel.PersonPrimaryInfo = unitOfWork.PersonPrimaryInfoRepository.GetByID(personPrimaryInfoID); contactTypeForPersonViewModel.PersonContactTypeSelectList = unitOfWork.PersonContactTypeRepository.PersonContactTypeSelectList(); return contactTypeForPersonViewModel; }