public IActionResult Create() { // Create the metadata info for the type SchemaFormInfo schemaFormInfo = _schemaFormBuilder.CreateSchemaForm(typeof(FullEmployeeVm)); // Create a response which contains the metadata and an empty resource return(Json(new { schemaFormInfo.Form, schemaFormInfo.Schema, Data = new EditEmployeeVm() })); }
public IActionResult Edit(int id) { // Find the employee to the specified id FullEmployeeVm employeeVm = _employees.SingleOrDefault(e => e.Id == id); if (employeeVm == null) { // The employee could not be found return(HttpNotFound()); } // Create the metadata info for the type SchemaFormInfo schemaFormInfo = _schemaFormBuilder.CreateSchemaForm(typeof(FullEmployeeVm)); // Create a response which contains the metadata and the resource return(Json(new { schemaFormInfo.Form, schemaFormInfo.Schema, Data = employeeVm.ToEditEmployeeVm() })); }
public object PutCodeToCompile([FromBody] JToken input) { CompiledFormDto result = new CompiledFormDto(); CompileResultContainer compileResult = null; if (input["csharpCode"] == null) { result.ErrorMessages.Add("No Code!"); return(result); } try { compileResult = CompileService.TryCompileAndSearchType(input["csharpCode"].ToString()); result.CompilationSuccessfull = compileResult.CompilationSuccessfull; result.TypeName = compileResult.TypeName; result.ErrorMessages = compileResult.ErrorMessages; if (compileResult.CompilationSuccessfull) { DefaultSchemaFormBuilder builder = new DefaultSchemaFormBuilder(); SchemaFormInfo schemaFormInfo = builder.CreateSchemaForm(compileResult.Type); result.Form = schemaFormInfo.Form; result.Schema = schemaFormInfo.Schema; } } catch (Exception e) { result.ErrorMessages.Add(e.ToString()); } finally { if (compileResult != null) { compileResult.ReleaseResources(); } } return(result); }