public DeleteToDoByPatientIdDataResponse DeleteToDoByPatientId(DeleteToDoByPatientIdDataRequest request) { DeleteToDoByPatientIdDataResponse response = new DeleteToDoByPatientIdDataResponse(); try { ISchedulingRepository repo = Factory.GetRepository(request, RepositoryType.ToDo); GetToDosDataRequest getToDosDataRequest = new GetToDosDataRequest { PatientId = request.PatientId, Context = request.Context, ContractNumber = request.ContractNumber, UserId = request.UserId, Version = request.Version }; GetToDosDataResponse toDosResponse = repo.FindToDos(getToDosDataRequest); List <ToDoData> patientToDos = (List <ToDoData>)toDosResponse.ToDos; //repo.FindToDos(getToDosDataRequest); List <string> deletedIds = null; if (patientToDos != null) { deletedIds = new List <string>(); patientToDos.ForEach(u => { request.Id = u.Id; repo.Delete(request); deletedIds.Add(request.Id); }); response.DeletedIds = deletedIds; } response.Success = true; return(response); } catch (Exception ex) { throw ex; } }
public GetToDosDataResponse GetToDos(GetToDosDataRequest request) { try { var result = new GetToDosDataResponse(); ISchedulingRepository repo = Factory.GetRepository(request, RepositoryType.ToDo); repo.UserId = request.UserId; result = (GetToDosDataResponse)repo.FindToDos(request); return(result); } catch (Exception ex) { throw ex; } }