Example #1
0
        public async Task <IActionResult> Demo(JsEvaluationViewModel editedModel)
        {
            var model = _jsEvaluationService.GetInitializationData();

            await TryUpdateModelAsync(model, string.Empty, m => m.EngineName, m => m.Expression);

            if (ModelState.IsValid)
            {
                model = _jsEvaluationService.Evaluate(model);

                ModelState.Clear();
            }

            return(View(model));
        }
Example #2
0
        public ActionResult Demo(FormCollection collection)
        {
            var model = _jsEvaluationService.GetInitializationData();

            TryUpdateModel(model, new[] { "EngineName", "Expression" }, collection);

            if (ModelState.IsValid)
            {
                model = _jsEvaluationService.Evaluate(model);

                ModelState.Clear();
            }

            return(View(model));
        }