public ActionResult OtherPermitsEdit(int PermitKey, OtherPermitsVM model) { if (!ModelState.IsValid) return PartialView("OtherPermitsAddEdit", model); try { ContactDO data = model.GetDataObject(); ContactBLL.SaveContact(data); AddressDO addressdata = model.GetAddressDataObject(); 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 OtherPermitsAdd(OtherPermitsVM model) { AddressDO addressdata = model.GetAddressDataObject(); if (string.IsNullOrEmpty(addressdata.City) && string.IsNullOrEmpty(addressdata.StateID)) { ModelState.Remove("Address11"); ModelState.Remove("City"); ModelState.Remove("StateID"); ModelState.Remove("ZipCode"); } if (!ModelState.IsValid) return PartialView("OtherPermitsAddEdit", model); try { ContactDO data = model.GetDataObject(); addressdata.ContactID = ContactBLL.SaveContact(data); if (!string.IsNullOrEmpty(addressdata.City) && !string.IsNullOrEmpty(addressdata.StateID)) 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 OtherPermitsEdit(int PermitKey, int Id) { ContactBO bo = ContactBLL.GetContact(Id); OtherPermitsVM model = new OtherPermitsVM(bo); return PartialView("OtherPermitsAddEdit", model); }
public ActionResult OtherPermitsAdd(int PermitKey) { OtherPermitsVM model = new OtherPermitsVM(); model.ContactTypeID = "Other Permits (Coal & Non-Coal)"; model.AddressTypeID = "Permanent"; model.PermitKey = PermitKey; return PartialView("OtherPermitsAddEdit", model); }