private async Task <List <HandlerServiceResult> > ConfigureOperationType(CategoryTypeEnum type, User user) { HandlerServiceResult nextQuestion; var categories = await _categoryDocumentService.GetByUserIdAsync(user.Id); categories = categories.Where(c => c.Configured && c.Type == type).ToList(); if (categories.Count > 0) { var operation = new Operation { Configured = false, Id = _operationDocumentService.GenerateNewId() }; await _operationDocumentService.InsertAsync(operation); user.Context = new Context { OperationId = operation.Id, CategoryType = type, CurrentNode = _tree }; nextQuestion = await _questionService.BuildQuestion(user); } else { nextQuestion = _resultService.BuildOperationTypeCleanCategoryList(); } await _userDocumentService.UpdateAsync(user); return(new List <HandlerServiceResult> { nextQuestion }); }
public async Task InsertOperationAsync(Operation operation) { await _operationDocumentService.InsertAsync(operation); }