public async Task <IEnumerable <WorkflowTransition> > Search(WorkflowTransitionSearchRequest requestArgs) { List <FilterDefinition <WorkflowTransition> > filters = new List <FilterDefinition <WorkflowTransition> >(); if (!string.IsNullOrEmpty(requestArgs.WorkflowId)) { filters.Add(Builders <WorkflowTransition> .Filter.Eq("WorkflowId", new ObjectId(requestArgs.WorkflowId))); } if (!string.IsNullOrEmpty(requestArgs.FromNodeId)) { filters.Add(Builders <WorkflowTransition> .Filter.Eq("FromNodeId", new ObjectId(requestArgs.FromNodeId))); } try { var filterConcat = Builders <WorkflowTransition> .Filter.And(filters); var transitions = await _context.WorkflowTransitions.Find(filterConcat).ToListAsync(); foreach (WorkflowTransition transition in transitions) { await HydrateForGet(transition); } return(transitions); } catch (Exception ex) { throw ex; } }
public async Task <IActionResult> Search([FromQuery] WorkflowTransitionSearchRequest requestArgs) { return(await FunctionWrapper.ExecuteFunction(this, async() => { if (string.IsNullOrEmpty(requestArgs.WorkflowId) && string.IsNullOrEmpty(requestArgs.FromNodeId)) { throw new System.Exception("Valid search criteria not supplied."); } return await _workflowTransitionRepository.Search(requestArgs); })); }