I am trying to implement an custom form in Piranha CMS 2.2.4. The form renders to a new page, showing only the form. My goal is the that the form renders juist like a normal content page.
My code snippets: Index.cmshtml
@inherits Piranha.WebPages.SinglePage<Piranha.Models.PageModel>
@{
var msg = "";
if (IsPost)
{
var order = new Order()
{
Item = Request["Item"],
Quantity = Request["Quantity"]
};
order.Save();
msg = "Your order is saved!";
}
}
@if (!String.IsNullOrEmpty(msg))
{
<p>@msg</p>
}
<div>
<form method="post">
<input name="Item" />
<input name="Quantity" />
<button type="submit">Let's buy it!</button>
</form>
</div>
Order.cs:
public class Order
{
public String Item { get; set; }
public String Quantity { get; set; }
public Order()
{
}
public void Save()
{
}
}
What I am missing?
Any help is appreciated
I don't think the default template has a _PageStart.cshtml, so unless you've added one manually specifying the Layout you need to specify it in your page.
Regards
Håkan