Beispiel #1
0
        public async Task <Model.Expression> Handle(CreateExpression message, CancellationToken cancellationToken)
        {
            var id         = Guid.NewGuid();
            var expression = this.repository.Create(new Expression()
            {
                ExpressionString = message.Expression,
                Id     = id,
                UserId = message.UserId,
                Name   = message.Name ?? GetName()
            });
            await repository.Save();

            return(new Model.Expression()
            {
                Id = expression.Id,
                ExpressionString = expression.ExpressionString,
                Name = expression.Name
            });
        }
        public void Initialize(Guid userId)
        {
            repository.Create(new Model.Database.Expression()
            {
                Id = Guid.NewGuid(),
                ExpressionString = "1 = 1",
                Name             = Constants.Expressions.All,
                UserId           = userId
            });

            repository.Save();
        }