public bool DeletePatientNote(DeletePatientNoteDataRequest request) { try { IMongoPatientNoteRepository repo = Factory.GetRepository(RepositoryType.PatientNote); repo.Delete(request); return(true); } catch (Exception ex) { throw ex; } }
public DeleteNoteByPatientIdDataResponse DeleteNoteByPatientId(DeleteNoteByPatientIdDataRequest request) { DeleteNoteByPatientIdDataResponse response = null; try { response = new DeleteNoteByPatientIdDataResponse(); IMongoPatientNoteRepository repo = Factory.GetRepository(RepositoryType.PatientNote); GetAllPatientNotesDataRequest getAllPatientNotesDataRequest = new GetAllPatientNotesDataRequest { Context = request.Context, ContractNumber = request.ContractNumber, PatientId = request.PatientId, UserId = request.UserId, Version = request.Version }; List <PatientNoteData> patientNotes = repo.FindByPatientId(getAllPatientNotesDataRequest) as List <PatientNoteData>; List <string> deletedIds = null; if (patientNotes != null) { deletedIds = new List <string>(); patientNotes.ForEach(u => { DeletePatientNoteDataRequest deletePatientNoteDataRequest = new DeletePatientNoteDataRequest { Context = request.Context, ContractNumber = request.ContractNumber, Id = u.Id, PatientId = request.PatientId, UserId = request.UserId, Version = request.Version }; repo.Delete(deletePatientNoteDataRequest); deletedIds.Add(deletePatientNoteDataRequest.Id); }); response.DeletedIds = deletedIds; } response.Success = true; return(response); } catch (Exception ex) { throw ex; } }