Integrating a Form Component
Our sample projects and report templates can help you learn the basics of working with our products.This example is outdated, you can check out the many other new examples in this category.This example shows how to integrate a form component.
public IActionResult Action()
{
try
{
var data = JObject.Parse(this.HttpContext.Request.Form["data"]);
var action = data["action"].ToString();
switch (action)
{
case "Initialize":
var initData = StiWebForm.Initialize(data, null);
return Json(initData.Content);
default:
var result = StiWebForm.ProcessRequest(data);
return result.ContentType switch
{
"application/pdf" => new FileContentResult(result.Content as byte[], result.ContentType),
_ => Json(result.Content),
};
}
}
catch (Exception e)
{
return new ContentResult()
{
Content = e.Message,
ContentType = "text/plain"
};
}
}