-
Notifications
You must be signed in to change notification settings - Fork 9
Controllers responses
All default controllers responses can be found in AcspNet.Responses namespace.
Loads specified template and puts it to data collector (template data will be added to MainContent variable of DataCollector).
StaticTpl(string templateFileName) - just loads and puts template data to DataCollector.
public override ControllerResponse Invoke()
{
return new StaticTpl("Default");
}StaticTpl(string templateFileName, string title) - the same as above, but also adds a site title into Title variable of DataCollector.
public override ControllerResponse Invoke()
{
return new StaticTpl("MyPageTemplate", StringTable.MyPageTitle);
}Puts a string into MainContent variable of DataCollector.
public override ControllerResponse Invoke()
{
return new Tpl("Some text");
}public override ControllerResponse Invoke()
{
return new Tpl("Some text", StringTable.MyPageTitle);
}public override ControllerResponse Invoke()
{
return new Tpl(TemplateFactory.Load("MyPageTemplate").Get(), StringTable.MyPageTitle);
}Sends specified string to client and HTML page will not be generated.
public override ControllerResponse Invoke()
{
return new Ajax("Some string");
}The same as Tpl, but at first parameter you can specify exact DataCollector variable name.
public override ControllerResponse Invoke()
{
return new InlineTpl("LoginControl", TemplateFactory.Load("LoginControlTemplate").Get());
}Geneares message box HTML template and puts it into MainContent variable of DataCollector.
public override ControllerResponse Invoke()
{
return new MessageBox("Some message box text");
}Geneares message box HTML template from inline message box templates files and sends it to client as Ajax controller response do.
public override ControllerResponse Invoke()
{
return new MessageBoxInline("Some message box text");
}Redirects client to specified URL or by specifying redirection type.
public override ControllerResponse Invoke()
{
return new Redirect("http://somelink.com");
}public override ControllerResponse Invoke()
{
return new Redirect(RedirectionType.PreviousPage);
}Sends file to a client
public override ControllerResponse Invoke()
{
return new File("MyFile.txt", "text/plain", Encoding.UTF8.GetBytes("My file content"));
}Serializes a view model and puts it into specified template, then that template will be put into MainContent variable of DataCollector.
public class LoginViewModel
{
[Required]
public string UserName { get; set; }
[Required]
public string Password { get; set; }
public bool RememberMe { get; set; }
}
public override ControllerResponse Invoke()
{
var model = new LoginViewModel {UserName = "Foo"};
return new ViewModel<LoginViewModel>("LoginPage", model);
}- Getting Started
- Main Simplify.Web principles
- Simplify.Web controllers
- Simplify.Web views
- Simplify.Web templates
- Simplify.Web configuration
- Templates variables
- Static content
- Template factory
- Data collector
- String table
- File reader
- Web context
- Environment
- Language manager
- Redirector
- HTML