Changed to use Authenticate asp.net event instead of Authorize
[castle.git] / MonoRail / TestSiteARSupport / Controllers / ProductLicenseController.cs
blob8bffcd978a6f9fce1aadaa6e685d3048c0a45bd5
1 // Copyright 2004-2007 Castle Project - http://www.castleproject.org/
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace TestSiteARSupport.Controllers
17 using Castle.Components.Binder;
18 using Castle.MonoRail.ActiveRecordSupport;
19 using Castle.MonoRail.Framework;
21 using TestSiteARSupport.Model;
23 [Layout("default")]
24 public class ProductLicenseController : ARSmartDispatcherController
26 public void New()
28 PropertyBag.Add("pl", new ProductLicense());
31 public void NewWithAccounts()
33 PropertyBag.Add("pl", new ProductLicense());
34 PropertyBag.Add("accounts", Account.FindAll());
37 [AccessibleThrough(Verb.Post)]
38 public void Insert([ARDataBind("pl", AutoLoad=AutoLoadBehavior.OnlyNested)] ProductLicense pl)
40 ErrorList errorList = (ErrorList) BoundInstanceErrors[pl];
42 PropertyBag.Add("errorlist", errorList);
44 if (errorList.Count == 0)
46 pl.Create();
48 PropertyBag.Add("pl", pl);
52 public void Edit([ARFetch("id", false, true)] ProductLicense pl)
54 PropertyBag.Add("pl", pl);
55 PropertyBag.Add("accounts", Account.FindAll());
58 [AccessibleThrough(Verb.Post)]
59 public void Update([ARDataBind("pl", AutoLoad=AutoLoadBehavior.Always)] ProductLicense pl)
61 ErrorList errorList = (ErrorList) BoundInstanceErrors[pl];
63 PropertyBag.Add("errorlist", errorList);
65 if (errorList.Count == 0)
67 pl.Update();
69 PropertyBag.Add("pl", pl);
73 public void RemoveConfirm([ARFetch("id", false, true)] ProductLicense pl)
75 PropertyBag.Add("pl", pl);
78 [AccessibleThrough(Verb.Post)]
79 public void Delete([ARDataBind("pl", AutoLoad=AutoLoadBehavior.Always)] ProductLicense pl)
81 pl.Delete();