コード例 #1
0
 public ActionResult CreateNew()
 {
     var model = new CreateMacroModel
         {
             AvailableMacroTypes = new SelectList(BackOfficeRequestContext.RegisteredComponents.MacroEngines.Select(x => x.Metadata.EngineName))
         };
     return View(model);
 }
コード例 #2
0
        public ActionResult CreateNewForm(CreateMacroModel createModel)
        {
            Mandate.ParameterNotNull(createModel, "createModel");            
            Mandate.That<NullReferenceException>(!string.IsNullOrEmpty(createModel.Name));

            //validate the model
            TryUpdateModel(createModel);
            //if at this point the model state is invalid, return the result which is the CreateNew view
            if (!ModelState.IsValid)
            {
                return View(createModel);
            }

            //everything is valid, now we need to render out the editor for this macro
            var editorModel = new MacroEditorModel
            {
                Name = createModel.Name,
                MacroType = createModel.MacroType,
                Alias = createModel.Name.ToRebelAlias(),
                SelectedItem = ""
            };

            EnsureModelListData(editorModel);


            return ProcessSubmit(editorModel);
        }