public ActionResult Index(string id)
        {
            var formCollection = new FormCollection(Request.QueryString);

            ViewBag.Id = id;

            var taskType = formCollection["AssemblyQualifiedTypeName"];

            ViewBag.TaskType = taskType;

            var task = TheTaskFactory.CreateTask(taskType);

            var ui = TheWorkflowEntityUiResolver.Resolve(task);

            var values = new Dictionary <string, object>();

            foreach (var prop in ui.UiProperties)
            {
                values[prop.PropertyName] = ControlExtensions.ControlValue(prop.RenderControl,
                                                                           formCollection[prop.PropertyName]);
            }
            if (values.ContainsKey("Id"))
            {
                values["Id"] = new Guid((string)values["Id"]);
            }

            TheHelper.SetProperties(task, values);
            ViewBag.PropertiesJson = TheHelper.JsSerializer.Serialize(values);

            return(View(ui.Render(task)));
        }
        public ActionResult SaveProperties(int id, FormCollection formCollection)
        {
            var config = TheWorkflowConfigurationService.GetConfiguration(id);
            var ui     = TheWorkflowEntityUiResolver.Resolve(config);

            var values = new Dictionary <string, object>();

            foreach (var prop in ui.UiProperties)
            {
                values[prop.PropertyName] = ControlExtensions.ControlValue(prop.RenderControl,
                                                                           formCollection[prop.PropertyName]);
            }

            TheWorkflowConfigurationService.SetConfigurationProperties(id, values);
            return(RedirectToAction("Index", "Home"));
        }
        public ActionResult Save(int id, FormCollection formCollection)
        {
            var instantiationCriteria = TheWorkflowInstantiationCriteriaService.GetCriteria(id);
            var ui = TheWorkflowEntityUiResolver.Resolve(instantiationCriteria);

            var values = new Dictionary <string, object>();

            foreach (var prop in ui.UiProperties)
            {
                values[prop.PropertyName] = ControlExtensions.ControlValue(prop.RenderControl,
                                                                           formCollection[prop.PropertyName]);
            }

            TheWorkflowInstantiationCriteriaService.SetConfigurationProperties(id, values);
            TheEventService.RegisterEvents();

            return(RedirectToAction("Index"));
        }