public PatientPreference UpdatePatientPreferenceData(int id, PatientPreference patientInfo) { try { if (id > 0) { var patientPreference = _context.PatientPreference.Find(id); if (patientPreference != null) { patientPreference.PatientID = patientInfo.PatientID; patientPreference.ReceiveSMS = patientInfo.ReceiveSMS; patientPreference.PreferredLanguageID = patientInfo.PreferredLanguageID; patientPreference.ServiceRequestedID = patientInfo.ServiceRequestedID; patientPreference.PatientHomeCommPreferencesID = patientInfo.PatientHomeCommPreferencesID; patientPreference.PatientOfficeCommPreferencesID = patientInfo.PatientOfficeCommPreferencesID; patientPreference.AddClientToCaseLoad = patientInfo.AddClientToCaseLoad; patientPreference.IsActive = patientInfo.IsActive; patientPreference.UpdatedDate = DateTime.Now; patientPreference.UpdatedBy = patientInfo.UpdatedBy; _context.SaveChanges(); } return(patientPreference); } return(null); } catch (Exception ex) { throw; } }
public override async Task <IActionResult> PatchAsync(int id, [FromBody] PatientPreference patientPreference) { //var attrToUpdate = _jsonApiContext.AttributesToUpdate; //var patientPreferenceOld = _dbContextResolver.GetDbSet<PatientPreference>().Where(m => m.Id == id).FirstOrDefault(); //CommonMethods commonMethods = new CommonMethods(); ////List<AuditLogs> auditLogs = commonMethods.GetAuditLogValues(patientPreferenceOld, patientPreference, "PatientPreference", 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, patientPreference); ////var patientPreferenceInfo = await base.PatchAsync(id, patientPreference); //int eventID = _dbContextResolver.GetDbSet<Event>().LastOrDefault().Id + 1; //List<AuditLogs> auditLogs = commonMethods.GetAuditLogValues(patientPreferenceOld, patientPreference, "PatientPreference", 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, patientPreference)); }
public override async Task <IActionResult> PostAsync([FromBody] PatientPreference patientPreference) { return(await base.PostAsync(patientPreference)); }
public PatientPreference UpdatePatientPreferenceData(int id, PatientPreference patientInfo) { return(_patientCommonRepository.UpdatePatientPreferenceData(id, patientInfo)); }