Exemplo n.º 1
0
        public ActionResult RenderActivity(ActivityViewModel model)
        {
            if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to edit workflows")))
            {
                return(new HttpUnauthorizedResult());
            }

            var activity = _activitiesManager.GetActivityByName(model.Name);

            if (activity == null)
            {
                return(HttpNotFound());
            }

            dynamic shape = New.Activity(activity);

            if (model.State != null)
            {
                var state = FormParametersHelper.ToDynamic(FormParametersHelper.ToString(model.State));
                shape.State(state);
            }
            else
            {
                shape.State(FormParametersHelper.FromJsonString("{}"));
            }

            shape.Metadata.Alternates.Add("Activity__" + activity.Name);

            return(new ShapeResult(this, shape));
        }