public ActionResult ContactAdd(ContactVM model)
        {
            model.Validate(ModelState);

            if (!ModelState.IsValid)
                return PartialView("ContactAddEdit", model);

            try
            {
                ContactDO data = model.WriteContactDataToTable();
                AddressDO addressdata = model.WritePermanentAddressDataToTable();
                AddressDO addressdata2 = model.WriteTemporaryAddressDataToTable();
                addressdata.ContactID = ContactBLL.SaveContact(data);
                ContactBLL.SaveAddress(addressdata);
                if (addressdata2.Address1 != null)
                {
                    addressdata2.AddressTypeID = "Temporary";
                    addressdata2.ContactID = ContactBLL.SaveContact(data);
                    ContactBLL.SaveAddress(addressdata2);
                }
                AjaxResult result = new AjaxResult(AjaxResult.AjaxStatus.OK, "Contact and address was saved");
                return Json(result);
            }
            catch (Exception ex)
            {
                AjaxResult result = new AjaxResult(AjaxResult.AjaxStatus.ERROR, ex.Message);
                return Json(result);
            }
        }
 public ActionResult ContactOtherAddBusiness(int PermitKey)
 {
     ContactVM model = new ContactVM();
     model.ContactTypeID = "Other";
     model.ContactClassID = "Business";
     model.AddressTypeID1 = "Permanent";
     model.PermitKey = PermitKey;
     return PartialView("ContactAddEdit", model);
 }
 public ActionResult ContactResidentAgentAddIndividual(int PermitKey)
 {
     ContactVM model = new ContactVM();
     model.ContactTypeID = "Resident Agent";
     model.ContactClassID = "Individual";
     model.PermitKey = PermitKey;
     model.AddressTypeID1 = "Permanent";
     return PartialView("ContactAddEdit", model);
 }
 public ActionResult ContactEdit(int PermitKey, int Id)
 {
     ContactBO bo = ContactBLL.GetContact(Id);
     ContactVM model = new ContactVM(bo);
     return PartialView("ContactAddEdit", model);
 }