public ActionResult SurfaceMineralOwnershipEdit(int PermitKey, SurfaceMineralOwnershipVM model)
        {
            if (!ModelState.IsValid)
                return PartialView("SurfaceMineralOwnershipAddEdit", model);

            try
            {
                ContactDO data = model.GetDataObject();
                ContactBLL.SaveContact(data);
                AddressDO addressdata = model.GetFirstAddressDataObject();
                ContactBLL.SaveAddress(addressdata);
                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 SurfaceMineralOwnershipAddIndividual(int PermitKey)
 {
     SurfaceMineralOwnershipVM model = new SurfaceMineralOwnershipVM();
     model.ContactTypeID = "Surface and Mineral Ownership";
     model.ContactClassID = "Individual";
     model.AddressTypeID = "Permanent";
     model.PermitKey = PermitKey;
     return PartialView("SurfaceMineralOwnershipAddEdit", model);
 }
 public ActionResult SurfaceMineralOwnershipEdit(int PermitKey, int Id)
 {
     ContactBO bo = ContactBLL.GetContact(Id);
     SurfaceMineralOwnershipVM model = new SurfaceMineralOwnershipVM(bo);
     return PartialView("SurfaceMineralOwnershipAddEdit", model);
 }
        public ActionResult SurfaceMineralOwnershipAdd(SurfaceMineralOwnershipVM model)
        {
            if (model.IsBusiness)
            {
                ModelState.Remove("SalutationID");
                ModelState.Remove("FirstName");
                ModelState.Remove("LastName");
            }
            else
            {
                ModelState.Remove("CompanyName");
            }

            // either address or PO Box are required
            if (ModelState["Address11"].Errors.Count == 0 || ModelState["POBox"].Errors.Count == 0)
            {
                ModelState.Remove("POBox");
                ModelState.Remove("Address11");
            }

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

            try
            {
                ContactDO data = model.GetDataObject();
                AddressDO addressdata = model.GetFirstAddressDataObject();
                addressdata.ContactID = ContactBLL.SaveContact(data);
                ContactBLL.SaveAddress(addressdata);
                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);
            }
        }