2 using Castle
.MonoRail
.Framework
;
3 using Castle
.MonoRail
.Framework
.Helpers
;
4 using Castle
.MonoRail
.ActiveRecordSupport
;
5 using <%= ModelsNamespace
%>;
6 using <%= HelpersNamespace
%>;
8 using <%= ApplicationControllerNamespace
%>;
11 namespace <%= Namespace
%>
14 /// <%= PluralHumanName %> controller
16 [Layout("<%= ControllerFileName %>"), Helper(typeof(ScaffoldHelper
))]
17 <% if Area
!= null: %>
18 [ControllerDetails(Area
="<%= Area %>")]
20 public class <%= ControllerName
%>Controller
: ApplicationController
24 RedirectToAction("list");
29 PropertyBag
["<%= PluralVarName %>"] = PaginationHelper
.CreatePagination(<%= ClassName
%>.FindAll(), 10);
32 public void View(int id
)
34 PropertyBag
["<%= VarName %>"] = <%= ModelClassName
%>.Find(id
);
37 public void Edit(int id
)
39 PropertyBag
["<%= VarName %>"] = <%= ModelClassName
%>.Find(id
);
42 public void Update([ARDataBind("<%= VarName %>", AutoLoadBehavior
.Always
)] <%= ModelClassName
%> <%= VarName
%>)
44 if (<%= VarName
%>.IsValid())
46 <%= VarName
%>.Update();
47 Flash
["edited"] = <%= VarName
%>.Id
;
48 RedirectToAction("list");
52 PropertyBag
["<%= VarName %>"] = <%= VarName
%>;
59 PropertyBag
["<%= VarName %>"] = new <%= ModelClassName
%>();
62 public void Create([DataBind("<%= VarName %>")] <%= ModelClassName
%> <%= VarName
%>)
64 if (<%= VarName
%>.IsValid())
66 <%= VarName
%>.Create();
67 Flash
["edited"] = <%= VarName
%>.Id
;
68 RedirectToAction("list");
72 PropertyBag
["<%= VarName %>"] = <%= VarName
%>;
77 public void Delete(int id
)
79 <%= ModelClassName
%>.Find(id
).Delete();