public ActionResult AddHomeAffairsOfficer(List <KeyValue> homeAffairsOfficer) { try { var homeAffairsOfficerPersonId = Guid.NewGuid().ToString(); KeyValueService.AddAttribute(homeAffairsOfficer, "Id", homeAffairsOfficerPersonId); GenericModelService.AddAuditAttributeForCreateEvent(homeAffairsOfficer, GetCurrentUserId()); var homeAffairsOfficerPersonReturnObject = PersonService.InsertPerson(homeAffairsOfficer); if (homeAffairsOfficerPersonReturnObject.State != "success") { return(Json(new { state = "error", message = "" }, JsonRequestBehavior.AllowGet)); } KeyValueService.AddAttribute(homeAffairsOfficer, "PersonId", homeAffairsOfficerPersonReturnObject.Id); var homeAffairsOfficerReturnObject = HomeAffairsOfficerService.InsertHomeAffairesOfficer(homeAffairsOfficer); if (homeAffairsOfficerReturnObject.State != "success") { return(Json(new { state = "error", message = "" }, JsonRequestBehavior.AllowGet)); } var newHomeAffairsOfficer = HomeAffairsOfficerService.QueryHomeAffairsOfficerById( Guid.Parse(homeAffairsOfficerReturnObject.Id)); return(Json(new { state = "success", homeAffairsOfficer = newHomeAffairsOfficer }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(new { state = "error", message = ex.Message }, JsonRequestBehavior.AllowGet)); } }
public ActionResult AddPayment(List <KeyValue> payment) { try { if (payment == null || payment.Count <= 0) { return(Json(new { state = "error", message = "" }, JsonRequestBehavior.AllowGet)); } KeyValueService.AddAttribute(payment, "Id", Guid.NewGuid().ToString()); KeyValueService.AddAttribute(payment, "CreatedOn", DateTime.Now.ToString(CultureInfo.InvariantCulture)); KeyValueService.AddAttribute(payment, "CreatedById", GetCurrentUserId()); var paymentReturnObject = PaymentService.InsertPayment(payment); if (paymentReturnObject.State == "success") { return(Json(new { state = "success", paymentId = paymentReturnObject.Id }, JsonRequestBehavior.AllowGet)); } return(Json(new { state = "error", message = "" }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(new { state = "error", message = ex.Message }, JsonRequestBehavior.AllowGet)); } }
public ActionResult AddFuneralDocument(HttpPostedFileBase document, int documentTypeId, string description, string funeralId) { var funeralDocument = new List <KeyValue>(); KeyValueService.AddAttribute(funeralDocument, "Id", Guid.NewGuid().ToString()); KeyValueService.AddAttribute(funeralDocument, "Name", document.FileName); KeyValueService.AddAttribute(funeralDocument, "FileName", document.FileName); KeyValueService.AddAttribute(funeralDocument, "MimeType", document.ContentType); KeyValueService.AddAttribute(funeralDocument, "Size", document.ContentLength.ToString()); KeyValueService.AddAttribute(funeralDocument, "DocumentTypeId", documentTypeId.ToString()); KeyValueService.AddAttribute(funeralDocument, "Description", description); KeyValueService.AddAttribute(funeralDocument, "FuneralId", funeralId); var stream = document.InputStream; var binaryReader = new BinaryReader(stream); var bytes = binaryReader.ReadBytes((int)stream.Length); GenericModelService.AddAuditAttributeForCreateEvent(funeralDocument, GetCurrentUserId()); DocumentService.InsertDocument(funeralDocument, bytes); var funeralDocumentReturnObject = FuneralDocumentService.InsertFuneralDocument(funeralDocument, bytes); return(funeralDocumentReturnObject.State == "success" ? Json(new { state = "success", funeralDocumentId = funeralDocumentReturnObject.Id }, JsonRequestBehavior.AllowGet) : Json("", JsonRequestBehavior.AllowGet)); }
public ActionResult AddDoctor(List <KeyValue> doctor) { try { if (doctor == null || doctor.Count <= 0) { return(Json(new { state = "error", message = "" }, JsonRequestBehavior.AllowGet)); } var doctorPersonId = Guid.NewGuid().ToString(); KeyValueService.AddAttribute(doctor, "Id", doctorPersonId); GenericModelService.AddAuditAttributeForCreateEvent(doctor, GetCurrentUserId()); var nextOfKinPersonReturnObject = PersonService.InsertPerson(doctor); if (nextOfKinPersonReturnObject.State != "success") { return(Json(new { state = "error", message = "" }, JsonRequestBehavior.AllowGet)); } KeyValueService.AddAttribute(doctor, "PersonId", doctorPersonId); var doctorReturnObject = DoctorService.InsertDoctor(doctor); if (doctorReturnObject.State == "success") { return(Json(new { state = "success", doctorId = doctorReturnObject.Id }, JsonRequestBehavior.AllowGet)); } return(Json(new { state = "error", message = "" }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(new { state = "error", message = ex.Message }, JsonRequestBehavior.AllowGet)); } }
public ActionResult AddMember(List <KeyValue> member) { try { if (member == null || member.Count <= 0) { return(Json(new { state = "error", message = "" }, JsonRequestBehavior.AllowGet)); } var memberPersonId = Guid.NewGuid().ToString(); KeyValueService.AddAttribute(member, "Id", memberPersonId); GenericModelService.AddAuditAttributeForCreateEvent(member, GetCurrentUserId()); var personReturnObject = PersonService.InsertPerson(member); if (personReturnObject.State != "success") { return(Json(new { state = "error", message = "" }, JsonRequestBehavior.AllowGet)); } var memberNumber = SharedService.RandomString(8); KeyValueService.AddAttribute(member, "MemberNumber", memberNumber); KeyValueService.AddAttribute(member, "PersonId", memberPersonId); var memberReturnObject = MemberService.InsertMember(member); if (memberReturnObject.State == "success") { return(Json(new { state = "success", memberId = memberReturnObject.Id }, JsonRequestBehavior.AllowGet)); } return(Json(new { state = "error", message = "" }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(new { state = "error", message = ex.Message }, JsonRequestBehavior.AllowGet)); } }
public ActionResult UpdateHomeAffairsOfficer(List <KeyValue> homeAffairsOfficer) { if (homeAffairsOfficer == null || homeAffairsOfficer.Count <= 0) { return(Json(new { state = "success", message = "" }, JsonRequestBehavior.AllowGet)); } KeyValueService.AddAttribute(homeAffairsOfficer, "ModifiedById", GetCurrentUserId()); var personReturnObject = PersonService.UpdatePerson(homeAffairsOfficer); return(personReturnObject.State == "success" ? Json(new { state = "success", homeAffairsOfficerId = personReturnObject.Id }, JsonRequestBehavior.AllowGet) : Json(new { state = "success", message = "" }, JsonRequestBehavior.AllowGet)); }
public ActionResult UpdateInformant(List <KeyValue> member) { if (member == null || member.Count <= 0) { return(Json(new { state = "success", message = "" }, JsonRequestBehavior.AllowGet)); } KeyValueService.AddAttribute(member, "ModifiedById", GetCurrentUserId()); var personReturnObject = PersonService.UpdatePerson(member); return(Json( personReturnObject.State != "success" ? new { state = "success", message = "" } : new { state = "error", message = "" }, JsonRequestBehavior.AllowGet)); }
public ActionResult AddSupplier(List <KeyValue> supplier) { try { var supplierId = Guid.NewGuid().ToString(); KeyValueService.AddAttribute(supplier, "Id", supplierId); var supplierReturnObject = SupplierService.InsertSupplier(supplier); return(supplierReturnObject.State == "success" ? Json(new { state = "success", supplierId = supplierReturnObject.Id }, JsonRequestBehavior.AllowGet) : Json(new { state = "error", hospital = "" }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(ex.Message, JsonRequestBehavior.AllowGet)); } }
public ActionResult UpdateDoctor(List <KeyValue> doctor) { if (doctor == null || doctor.Count <= 0) { return(Json(new { state = "success", message = "" }, JsonRequestBehavior.AllowGet)); } KeyValueService.AddAttribute(doctor, "ModifiedById", GetCurrentUserId()); var doctorPersonReturnObject = PersonService.UpdatePerson(doctor); if (doctorPersonReturnObject.State != "success") { return(Json(new { state = "success", message = "" }, JsonRequestBehavior.AllowGet)); } var doctorReturnObject = DoctorService.UpdateDoctor(doctor); return(doctorReturnObject.State == "success" ? Json(new { state = "success", doctorId = doctorReturnObject.Id }, JsonRequestBehavior.AllowGet) : Json(new { state = "success", message = "" }, JsonRequestBehavior.AllowGet)); }
public ActionResult UpdateNextOfKin(List <KeyValue> nextOfKin) { if (nextOfKin == null || nextOfKin.Count <= 0) { return(Json(new { state = "success", message = "" }, JsonRequestBehavior.AllowGet)); } KeyValueService.AddAttribute(nextOfKin, "ModifiedById", GetCurrentUserId()); var personReturnObject = PersonService.UpdatePerson(nextOfKin); if (personReturnObject.State != "success") { return(Json(new { state = "success", message = "" }, JsonRequestBehavior.AllowGet)); } var returnObject = InformantService.UpdateInformant(nextOfKin); return(returnObject.State == "success" ? Json(new { state = "success", nextOfKinId = returnObject.Id }, JsonRequestBehavior.AllowGet) : Json(new { state = "success", message = "" }, JsonRequestBehavior.AllowGet)); }
public ActionResult UpdateInformant(List <KeyValue> informant) { if (informant == null || informant.Count <= 0) { return(Json(new { state = "success", message = "" }, JsonRequestBehavior.AllowGet)); } KeyValueService.AddAttribute(informant, "ModifiedById", GetCurrentUserId()); var informantPersonReturnObject = PersonService.UpdatePerson(informant); if (informantPersonReturnObject.State != "success") { return(Json(new { state = "success", message = "" }, JsonRequestBehavior.AllowGet)); } var informantReturnObject = InformantService.UpdateInformant(informant); return(informantReturnObject.State == "success" ? Json(new { state = "success", informantId = informantReturnObject.Id }, JsonRequestBehavior.AllowGet) : Json(new { state = "success", message = "" }, JsonRequestBehavior.AllowGet)); }
public ActionResult UpdateDeceased(List <KeyValue> deceased) { if (deceased == null || deceased.Count <= 0) { return(Json(new { state = "success", message = "" }, JsonRequestBehavior.AllowGet)); } KeyValueService.AddAttribute(deceased, "ModifiedById", GetCurrentUserId()); var deceasedPersonReturnObject = PersonService.UpdatePerson(deceased); if (deceasedPersonReturnObject.State != "success") { return(Json(new { state = "success", message = "" }, JsonRequestBehavior.AllowGet)); } var deceasedReturnObject = DeceasedService.UpdateDeceased(deceased); return(deceasedReturnObject.State == "success" ? Json(new { state = "success", deceasedId = deceasedReturnObject.Id }, JsonRequestBehavior.AllowGet) : Json(new { state = "success", message = "" }, JsonRequestBehavior.AllowGet)); }
public ActionResult AddDocument(HttpPostedFileBase proofOfPayment) { try { if (proofOfPayment == null) { return(Json(new { state = "error", message = "" }, JsonRequestBehavior.AllowGet)); } var documentId = Guid.NewGuid().ToString(); var document = new List <KeyValue>(); KeyValueService.AddAttribute(document, "Id", documentId); KeyValueService.AddAttribute(document, "FileName", proofOfPayment.FileName); KeyValueService.AddAttribute(document, "MimeType", proofOfPayment.ContentType); KeyValueService.AddAttribute(document, "Size", proofOfPayment.ContentLength.ToString()); KeyValueService.AddAttribute(document, "CreatedOn", DateTime.Now.ToString(CultureInfo.InvariantCulture)); KeyValueService.AddAttribute(document, "CreatedById", GetCurrentUserId()); var stream = proofOfPayment.InputStream; var binaryReader = new BinaryReader(stream); var bytes = binaryReader.ReadBytes((int)stream.Length); var documentReturnObject = DocumentService.InsertDocument(document, bytes); if (documentReturnObject.State == "success") { return(Json(new { state = "success", documentId = documentReturnObject.Id }, JsonRequestBehavior.AllowGet)); } return(Json(new { state = "error", message = "" }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(new { state = "error", message = ex.Message }, JsonRequestBehavior.AllowGet)); } }
public ActionResult CreateFuneral(List <KeyValue> deceased, List <KeyValue> informant, List <KeyValue> nextOfKin, List <KeyValue> doctor, List <KeyValue> homeAffairsOfficer, List <KeyValue> funeral) { if (funeral == null) { funeral = new List <KeyValue>(); } if (deceased != null && deceased.Count > 0) { var deceasedAddress = KeyValueService.GetAttributeValue(deceased, "FullAddress"); if (deceasedAddress != null) { var address = new List <KeyValue>(); KeyValueService.AddAttribute(address, "Id", Guid.NewGuid().ToString()); KeyValueService.AddAttribute(address, "FullAddress", deceasedAddress); var addressReturnObject = AddressService.InsertAddress(address); if (addressReturnObject.State == "success") { KeyValueService.AddAttribute(deceased, "AddressId", addressReturnObject.Id); } } var deceasedPersonId = Guid.NewGuid().ToString(); KeyValueService.AddAttribute(deceased, "Id", deceasedPersonId); GenericModelService.AddAuditAttributeForCreateEvent(deceased, GetCurrentUserId()); var deceasedPersonReturnObject = PersonService.InsertPerson(deceased); if (deceasedPersonReturnObject.State == "success") { KeyValueService.AddAttribute(deceased, "PersonId", deceasedPersonId); var deceasedReturnObject = DeceasedService.InsertDeceased(deceased); if (deceasedReturnObject.State == "success") { KeyValueService.AddAttribute(funeral, "DeceasedId", deceasedReturnObject.Id); } } } if (informant != null && informant.Count > 0) { var informantPersonId = Guid.NewGuid().ToString(); KeyValueService.AddAttribute(informant, "Id", informantPersonId); GenericModelService.AddAuditAttributeForCreateEvent(informant, GetCurrentUserId()); var informantPersonReturnObject = PersonService.InsertPerson(informant); if (informantPersonReturnObject.State == "success") { KeyValueService.AddAttribute(informant, "PersonId", informantPersonId); var informantReturnObject = InformantService.InsertInformant(informant); if (informantReturnObject.State == "success") { KeyValueService.AddAttribute(funeral, "InformantId", informantReturnObject.Id); } } } if (nextOfKin != null && nextOfKin.Count > 0) { var nextOfKinPersonId = Guid.NewGuid().ToString(); KeyValueService.AddAttribute(nextOfKin, "Id", nextOfKinPersonId); GenericModelService.AddAuditAttributeForCreateEvent(nextOfKin, GetCurrentUserId()); var nextOfKinPersonReturnObject = PersonService.InsertPerson(nextOfKin); if (nextOfKinPersonReturnObject.State == "success") { KeyValueService.AddAttribute(nextOfKin, "PersonId", nextOfKinPersonId); var nextOfKinReturnObject = NextOfKinService.InsertNextOfKin(nextOfKin); if (nextOfKinReturnObject.State == "success") { KeyValueService.AddAttribute(funeral, "NextOfKinId", nextOfKinReturnObject.Id); } } } if (doctor != null && doctor.Count > 0) { if (KeyValueService.AttributeContainsValue(doctor, "Id")) { var doctorPersonId = KeyValueService.GetAttributeValue(doctor, "Id"); KeyValueService.AddAttribute(funeral, "DoctorId", doctorPersonId); } else { var doctorPersonId = Guid.NewGuid().ToString(); KeyValueService.AddAttribute(doctor, "Id", doctorPersonId); GenericModelService.AddAuditAttributeForCreateEvent(doctor, GetCurrentUserId()); var nextOfKinPersonReturnObject = PersonService.InsertPerson(doctor); if (nextOfKinPersonReturnObject.State == "success") { KeyValueService.AddAttribute(doctor, "PersonId", doctorPersonId); var doctorReturnObject = DoctorService.InsertDoctor(doctor); if (doctorReturnObject.State == "success") { KeyValueService.AddAttribute(funeral, "DoctorId", doctorReturnObject.Id); } } } } if (homeAffairsOfficer != null && homeAffairsOfficer.Count > 0) { if (KeyValueService.AttributeContainsValue(homeAffairsOfficer, "Id")) { var homeAffairsOfficerPersonId = KeyValueService.GetAttributeValue(homeAffairsOfficer, "Id"); KeyValueService.AddAttribute(funeral, "HomeAffairsOfficerId", homeAffairsOfficerPersonId); } else { var homeAffairsOfficerPersonId = Guid.NewGuid().ToString(); KeyValueService.AddAttribute(homeAffairsOfficer, "Id", homeAffairsOfficerPersonId); GenericModelService.AddAuditAttributeForCreateEvent(homeAffairsOfficer, GetCurrentUserId()); var homeAffairsOfficerPersonReturnObject = PersonService.InsertPerson(homeAffairsOfficer); if (homeAffairsOfficerPersonReturnObject.State == "success") { KeyValueService.AddAttribute(homeAffairsOfficer, "PersonId", homeAffairsOfficerPersonReturnObject.Id); var homeAffairsOfficerReturnObject = HomeAffairsOfficerService.InsertHomeAffairesOfficer(homeAffairsOfficer); if (homeAffairsOfficerReturnObject.State == "success") { KeyValueService.AddAttribute(funeral, "HomeAffairsOfficerId", homeAffairsOfficerReturnObject.Id); } } } } if (funeral.Count <= 0) { return(Json(new { state = "error", message = "" }, JsonRequestBehavior.AllowGet)); } var funeralId = Guid.NewGuid().ToString(); KeyValueService.AddAttribute(funeral, "Id", funeralId); #region Get Vehicle Number var counterConfiguration = NumberConfigurationService.GetNextNumber("funeral"); var counterConfigurationId = (Guid)counterConfiguration.FirstOrDefault(x => x.Key == "Id").Value; var entityName = (string)counterConfiguration.FirstOrDefault(x => x.Key == "EntityName").Value; var nextNumber = (int)counterConfiguration.FirstOrDefault(x => x.Key == "NextNumber").Value; var prefix = (string)counterConfiguration.FirstOrDefault(x => x.Key == "Prefix").Value; var incrementBy = (int)counterConfiguration.FirstOrDefault(x => x.Key == "IncrementBy").Value; var length = (int)counterConfiguration.FirstOrDefault(x => x.Key == "Length").Value; var number = length == 0 ? "" : nextNumber.ToString("D" + length); var funeralNumber = prefix + number; #endregion KeyValueService.AddAttribute(funeral, "FuneralNumber", funeralNumber); GenericModelService.AddAuditAttributeForCreateEvent(funeral, GetCurrentUserId()); var funeralReturnObject = FuneralService.InsertFuneral(funeral); if (funeralReturnObject.State != "success") { return(Json(new { state = "error", message = "" }, JsonRequestBehavior.AllowGet)); } nextNumber = nextNumber + incrementBy; NumberConfigurationService.SetNextNumber(counterConfigurationId.ToString(), entityName, nextNumber); return(Json(new { state = "success", funeralId = funeralReturnObject.Id }, JsonRequestBehavior.AllowGet)); }
public ActionResult UpdateFuneral(List <KeyValue> deceased, List <KeyValue> informant, List <KeyValue> nextOfKin, List <KeyValue> doctor, List <KeyValue> homeAffairsOfficer, List <KeyValue> funeral) { var funeralId = Guid.Empty; if (funeral == null) { funeral = new List <KeyValue>(); } else { funeralId = Guid.Parse(funeral.FirstOrDefault(x => x.Key == "Id")?.Value); } if (deceased != null && deceased.Count > 0) { KeyValueService.AddAttribute(deceased, "ModifiedById", GetCurrentUserId()); var deceasedPersonReturnObject = PersonService.UpdatePerson(deceased); if (deceasedPersonReturnObject.State == "success") { var deceasedReturnObject = DeceasedService.UpdateDeceased(deceased); } } if (informant != null && informant.Count > 0) { var existingInformantCount = InformantService.QueryCountOfInformantsByFuneralId(funeralId); if (existingInformantCount > 0) { KeyValueService.AddAttribute(informant, "ModifiedById", GetCurrentUserId()); var informantPersonReturnObject = PersonService.UpdatePerson(informant); if (informantPersonReturnObject.State == "success") { var informantReturnObject = InformantService.UpdateInformant(informant); } } else { var informantPersonId = Guid.NewGuid().ToString(); KeyValueService.AddAttribute(informant, "Id", informantPersonId); GenericModelService.AddAuditAttributeForCreateEvent(informant, GetCurrentUserId()); var informantPersonReturnObject = PersonService.InsertPerson(informant); if (informantPersonReturnObject.State == "success") { KeyValueService.AddAttribute(informant, "PersonId", informantPersonId); var informantReturnObject = InformantService.InsertInformant(informant); if (informantReturnObject.State == "success") { KeyValueService.SetOrAddAttribute(funeral, "InformantId", informantReturnObject.Id); } } } } if (nextOfKin != null && nextOfKin.Count > 0) { var existingNextOfKinCount = NextOfKinService.QueryCountOfNextOsKinssByFuneralId(funeralId); if (existingNextOfKinCount > 0) { KeyValueService.AddAttribute(nextOfKin, "ModifiedById", GetCurrentUserId()); var nextOfKinPersonReturnObject = PersonService.UpdatePerson(nextOfKin); if (nextOfKinPersonReturnObject.State == "success") { var nextOfKinReturnObject = NextOfKinService.UpdateNextOfKin(nextOfKin); } } else { var nextOfKinPersonId = Guid.NewGuid().ToString(); KeyValueService.AddAttribute(nextOfKin, "Id", nextOfKinPersonId); GenericModelService.AddAuditAttributeForCreateEvent(nextOfKin, GetCurrentUserId()); var nextOfKinPersonReturnObject = PersonService.InsertPerson(nextOfKin); if (nextOfKinPersonReturnObject.State == "success") { KeyValueService.AddAttribute(nextOfKin, "PersonId", nextOfKinPersonId); var nextOfKinReturnObject = NextOfKinService.InsertNextOfKin(nextOfKin); if (nextOfKinReturnObject.State == "success") { KeyValueService.SetOrAddAttribute(funeral, "NextOfKinId", nextOfKinReturnObject.Id); } } } } //if (doctor != null && doctor.Count > 0) //{ // var existingDoctorCount = DoctorService.QueryCountOfDoctorsByFuneralId(funeralId); // if (existingDoctorCount > 0) // { // KeyValueService.AddAttribute(doctor, "ModifiedById", GetCurrentUserId()); // var nextOfKinPersonReturnObject = PersonService.UpdatePerson(doctor); // if (nextOfKinPersonReturnObject.State == "success") // { // DoctorService.UpdateDoctor(doctor); // } // } // else // { // var doctorPersonId = Guid.NewGuid().ToString(); // KeyValueService.AddAttribute(doctor, "Id", doctorPersonId); // GenericModelService.AddAuditAttributeForCreateEvent(doctor, GetCurrentUserId()); // var nextOfKinPersonReturnObject = PersonService.InsertPerson(doctor); // if (nextOfKinPersonReturnObject.State == "success") // { // KeyValueService.AddAttribute(doctor, "PersonId", doctorPersonId); // var doctorReturnObject = DoctorService.InsertDoctor(doctor); // KeyValueService.SetOrAddAttribute(funeral, "DoctorId", doctorReturnObject.Id); // } // } //} //if (homeAffairsOfficer != null && homeAffairsOfficer.Count > 0) //{ // var existingHomeAffairsOfficerCount = HomeAffairsOfficerService.QueryCountOfHomeAffairsOfficersByFuneralId(funeralId); // if(existingHomeAffairsOfficerCount > 0) // { // KeyValueService.AddAttribute(homeAffairsOfficer, "ModifiedById", GetCurrentUserId()); // var homeAffairsOfficerPersonReturnObject = PersonService.UpdatePerson(homeAffairsOfficer); // } // else // { // var homeAffairsOfficerPersonId = Guid.NewGuid().ToString(); // KeyValueService.AddAttribute(homeAffairsOfficer, "Id", homeAffairsOfficerPersonId); // GenericModelService.AddAuditAttributeForCreateEvent(homeAffairsOfficer, GetCurrentUserId()); // var homeAffairsOfficerPersonReturnObject = PersonService.InsertPerson(homeAffairsOfficer); // if (homeAffairsOfficerPersonReturnObject.State == "success") // { // KeyValueService.AddAttribute(homeAffairsOfficer, "PersonId", Guid.NewGuid().ToString()); // var homeAffairsOfficerReturnObject = HomeAffairsOfficerService.InsertHomeAffairesOfficer(homeAffairsOfficer); // if(homeAffairsOfficerReturnObject.State == "success") // { // KeyValueService.SetOrAddAttribute(funeral, "HomeAffairsOfficerId", homeAffairsOfficerReturnObject.Id); // } // } // } //} if (funeral.Count <= 0) { return(Json("error", JsonRequestBehavior.AllowGet)); } KeyValueService.AddAttribute(funeral, "ModifiedById", GetCurrentUserId()); var funeralReturnObject = FuneralService.UpdateFuneral(funeral); return(funeralReturnObject.State == "success" ? Json(new { state = "success", funeralId = funeralReturnObject.Id }, JsonRequestBehavior.AllowGet) : Json("error", JsonRequestBehavior.AllowGet)); }