Ejemplo n.º 1
0
        public async Task <IActionResult> Search([FromQuery] WorkflowFunctionSearchRequest requestArgs)
        {
            return(await FunctionWrapper.ExecuteFunction(this, async() =>
            {
                if (!Enum.IsDefined(typeof(WorkflowFunctionTypes), requestArgs.Type))
                {
                    throw new ApplicationException("Invalid function type specified.");
                }

                return await _workflowFunctionRepository.Search(requestArgs);
            }));
        }
        public async Task <IEnumerable <WorkflowFunction> > Search(WorkflowFunctionSearchRequest requestArgs)
        {
            if (!Enum.IsDefined(typeof(WorkflowFunctionTypes), requestArgs.Type))
            {
                throw new ApplicationException("Invalid function type specified.");
            }

            var filter = Builders <WorkflowFunction> .Filter.Eq("Type", requestArgs.Type);

            try
            {
                return(await _context.WorkflowFunctions.Find(filter).ToListAsync());
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }