public void UpdatePatientNotes(int patientNoteId, PatientNote patientNote)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         try
         {
             var patientNoteToUpdate = GetPatientNoteById(patientNote.PatientId, patientNoteId);
             if (patientNoteToUpdate != null)
             {
                 patientNoteToUpdate.Notes   = patientNote.Notes;
                 patientNoteToUpdate.Date    = patientNote.Date;
                 patientNoteToUpdate.Subject = patientNote.Subject;
                 dataContext.PatientNotes.Attach(patientNoteToUpdate);
                 dataContext.Entry(patientNoteToUpdate).State = EntityState.Modified;
                 dataContext.SaveChanges();
             }
         }
         catch (DbEntityValidationException ex)
         {
             throw new Exception(ex.EntityValidationErrors.GetValidationErrors());
         }
         catch
         {
             throw;
         }
     }
 }
 public void SavePatientNotes(PatientNote patientNotes)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         try
         {
             dataContext.PatientNotes.Add(patientNotes);
             dataContext.SaveChanges();
         }
         catch (DbEntityValidationException ex)
         {
             throw new Exception(ex.EntityValidationErrors.GetValidationErrors());
         }
         catch
         {
             throw;
         }
     }
 }
 public void SavePatientNotes(PatientNote patientNotes)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         try
         {
             dataContext.PatientNotes.Add(patientNotes);
             dataContext.SaveChanges();
         }
         catch (DbEntityValidationException ex)
         {
             throw new Exception(ex.EntityValidationErrors.GetValidationErrors());
         }
         catch
         {
             throw;
         }
     }
 }
 public void UpdatePatientNotes(int patientNoteId, PatientNote patientNote)
 {
     using (var dataContext = new eHealthCareEntities())
     {
         try
         {
             var patientNoteToUpdate = GetPatientNoteById(patientNote.PatientId, patientNoteId);
             if (patientNoteToUpdate != null)
             {
                 patientNoteToUpdate.Notes = patientNote.Notes;
                 patientNoteToUpdate.Date = patientNote.Date;
                 patientNoteToUpdate.Subject = patientNote.Subject;
                 dataContext.PatientNotes.Attach(patientNoteToUpdate);
                 dataContext.Entry(patientNoteToUpdate).State = EntityState.Modified;
                 dataContext.SaveChanges();
             }
         }
         catch (DbEntityValidationException ex)
         {
             throw new Exception(ex.EntityValidationErrors.GetValidationErrors());
         }
         catch
         {
             throw;
         }
     }
 }