public int updateSocialHistory(PatientSocialHistory SH) { using (UnitOfWork unitOfWork = new UnitOfWork(new GreencardContext())) { unitOfWork.SocialHistoryRepository.Update(SH); result = unitOfWork.Complete(); unitOfWork.Dispose(); return(result); } }
public int AddSocialHistory(PatientSocialHistory SH) { using (UnitOfWork unitOfWork = new UnitOfWork(new GreencardContext())) { unitOfWork.SocialHistoryRepository.Add(SH); unitOfWork.Complete(); unitOfWork.Dispose(); return(SH.Id); } }
public int updateSocialHistory(int patientId, int patientMasterVisitId, int createdBy, int drinkAlcohol, int smoke, int useDrugs, string socialHistoryNotes, int socialHistoryId, int recordSocialHistory) { PatientSocialHistory sHtx = new PatientSocialHistory() { PatientId = patientId, PatientMasterVisitId = patientMasterVisitId, DrinkAlcoholId = drinkAlcohol, SmokeId = smoke, UseDrugsId = useDrugs, SocialHistoryNotes = socialHistoryNotes, RecordSocialHistory = recordSocialHistory, Id = socialHistoryId }; //check if social history exists List <PatientSocialHistory> SocialHistoryList = new List <PatientSocialHistory>(); int SocialHistoryResult = 0; SocialHistoryResult = socialHistory.updateSocialHistory(sHtx); return(SocialHistoryResult); }
public override async Task <IActionResult> PatchAsync(int id, [FromBody] PatientSocialHistory patientSocialHistory) { //var attrToUpdate = _jsonApiContext.AttributesToUpdate; //var patientSocialHistoryOld = _dbContextResolver.GetDbSet<PatientSocialHistory>().Where(m => m.Id == id).FirstOrDefault(); //CommonMethods commonMethods = new CommonMethods(); ////List<AuditLogs> auditLogs = commonMethods.GetAuditLogValues(patientSocialHistoryOld, patientSocialHistory, "PatientSocialHistory", attrToUpdate) //// //.Where(i => attrToUpdate.Keys.Any(a1 => a1.InternalAttributeName == i.PropertyName)) //// .Select(q => new AuditLogs() { NewValue = q.NewValue, OldValue = q.OldValue, PrimaryKeyID = q.PrimaryKeyID, TableName = q.TableName, PropertyName = q.PropertyName }).ToList(); ////await _dbContextResolver.GetDbSet<AuditLogs>().AddRangeAsync(auditLogs); ////return await base.PatchAsync(id, patientSocialHistory); //// var patientSocialHistoryInfo = await base.PatchAsync(id, patientSocialHistory); //int eventID = _dbContextResolver.GetDbSet<Event>().LastOrDefault().Id + 1; //List<AuditLogs> auditLogs = commonMethods.GetAuditLogValues(patientSocialHistoryOld, patientSocialHistory, "PatientSocialHistory", attrToUpdate) // //.Where(i => attrToUpdate.Keys.Any(a1 => a1.InternalAttributeName == i.PropertyName)) // .Select(q => new AuditLogs() { NewValue = q.NewValue, OldValue = q.OldValue, PrimaryKeyID = q.PrimaryKeyID, TableName = q.TableName, PropertyName = q.PropertyName, EventID = eventID }).ToList(); //await _dbContextResolver.GetDbSet<AuditLogs>().AddRangeAsync(auditLogs); return(await base.PatchAsync(id, patientSocialHistory)); }
public PatientSocialHistory UpdatePatientSocialHistoryData(int id, PatientSocialHistory patientInfo) { if (id > 0) { var patientDiagnosis = _context.PatientSocialHistory.Find(id); if (patientDiagnosis != null) { patientDiagnosis.AlcohalID = patientInfo.AlcohalID; patientDiagnosis.DrugID = patientInfo.DrugID; patientDiagnosis.Occupation = patientInfo.Occupation; patientDiagnosis.PatientID = patientInfo.PatientID; patientDiagnosis.TobaccoID = patientInfo.TobaccoID; patientDiagnosis.TravelID = patientInfo.TravelID; patientDiagnosis.IsActive = patientInfo.IsActive; patientDiagnosis.UpdatedBy = patientInfo.UpdatedBy; patientDiagnosis.UpdatedDate = DateTime.Now; _context.SaveChanges(); return(patientDiagnosis); } } return(null); }
public override async Task <IActionResult> PostAsync([FromBody] PatientSocialHistory patientSocialHistory) { return(await base.PostAsync(patientSocialHistory)); }
public PatientSocialHistory UpdatePatientSocialHistoryData(int id, PatientSocialHistory patientInfo) { return(_patientCommonRepository.UpdatePatientSocialHistoryData(id, patientInfo)); }