public async Task <Guid?> Handle(CreateFunctionCommand request,
                                             CancellationToken cancellationToken)
            {
                var function = new Data.Models.Function
                {
                    CreationDate   = DateTime.Now,
                    Approximation  = request.Approximation,
                    FunctionString = request.FunctionString,
                    Min            = request.Min,
                    Max            = request.Max,
                    Name           = request.Name
                };

                _eqManager = new Equation(function);
                if (!_eqManager.CheckSyntax())
                {
                    return(null);
                }
                await _context.AddAsync(function, cancellationToken);

                await _context.SaveChangesAsync(cancellationToken);

                return(function.FunctionId);
            }
Example #2
0
 public Equation(Data.Models.Function functionData)
 {
     this.functionData = functionData;
     function          = new org.mariuszgromada.math.mxparser.Function(functionData.FunctionString);
 }