public int SavePatientReportStore(lmsPatientReportStore lmsPatientReportStore) { var resultId = 0; try { if (lmsPatientReportStore.PATIENTID.HasValue && lmsPatientReportStore.PATIENTID.Value <= 0) { lmsPatientReportStore.PATIENTID = null; } if (lmsPatientReportStore.REPORTID > 0) { _objLabManagementEntities.lmsPatientReportStores.Attach(lmsPatientReportStore); _objLabManagementEntities.Entry(lmsPatientReportStore).State = EntityState.Modified; _objLabManagementEntities.SaveChanges(); return(lmsPatientReportStore.REPORTID); } _objLabManagementEntities.lmsPatientReportStores.Add(lmsPatientReportStore); _objLabManagementEntities.SaveChanges(); resultId = _objLabManagementEntities.lmsPatientReportStores.ToList().LastOrDefault().REPORTID; } catch (Exception ex) { _objIAppLogger.LogError(ex); } return(resultId); }
public ActionResult SavePatientReportStore(lmsPatientReportStore lmsPatientReportStore) { lmsPatientReportStore.PATIENTID = lmsPatientReportStore.SelectedPatient; lmsPatientReportStore.CREATEDDATE = DateTime.Now; var saveReportDetails = _objIInvoice.SavePatientReportStore(lmsPatientReportStore); return(Json(new { reportId = saveReportDetails, viewMessage = "Patient Report Details Saved Successfully" }, JsonRequestBehavior.AllowGet)); }