public async Task <long> Count(RequestWorkflowStepMappingFilter filter)
        {
            IQueryable <RequestWorkflowStepMappingDAO> query = DataContext.RequestWorkflowStepMapping.AsNoTracking();

            if (filter.RequestId != null)
            {
                query = query.Where(q => q.RequestId, filter.RequestId);
            }
            if (filter.WorkflowStepId != null)
            {
                query = query.Where(q => q.WorkflowStepId, filter.WorkflowStepId);
            }
            return(await query.CountAsync());
        }
Ejemplo n.º 2
0
        private async Task <bool> ValidateWorkflowStepInUsed(WorkflowStep WorkflowStep)
        {
            RequestWorkflowStepMappingFilter RequestWorkflowStepMappingFilter = new RequestWorkflowStepMappingFilter
            {
                WorkflowStepId = new IdFilter {
                    Equal = WorkflowStep.Id
                }
            };

            var count = await UOW.RequestWorkflowStepMappingRepository.Count(RequestWorkflowStepMappingFilter);

            if (count != 0)
            {
                WorkflowStep.AddError(nameof(WorkflowStepValidator), nameof(WorkflowStep.Id), ErrorCode.WorkflowStepInUsed);
            }
            return(WorkflowStep.IsValidated);
        }