コード例 #1
0
        private async Task <Operation> GetOrCreateOperationAsync(User user)
        {
            Operation operation;

            if (user.Context.OperationId == null)
            {
                operation = new Operation
                {
                    Id         = _operationDocumentService.GenerateNewId(),
                    CategoryId = user.Context.CategoryId
                };

                await _documentServiceHelper.InsertOperationAsync(operation);
            }
            else
            {
                operation = await _documentServiceHelper.GetOperationByIdAsync(user.Context.OperationId);
            }

            return(operation);
        }