Monday, August 08, 2005

Eco on Rails

I've successfully tested ECO with EcoAccess on MonoRail Web application framework.
It worked great, and I have some codes to show here.

/// EcoController.cs
using Castle.MonoRail.Framework;
using Centillex.EcoAccess;
using User;

namespace EcoRailsSample
{
public class EcoController : SmartDispatcherController {

UserEcoSpace eco = new UserEcoSpace();

public void List() {
}

public void Edit(int id) {
}

public void View(int id) {
if(eco.Active == false) eco.Active = true;
ISystemUserEA si;
si = (ISystemUserEA) AccessFactory.Create(eco, typeof(ISystemUserEA));
PropertyBag["system_user"] = si.FindById(id);
}
}
}


I set a simple HTML in View.vm (NVelocity template) like this:

## View.vm
<h3>System User</h3>

Name : $system_user.FirstName <br/>
Last Name: $system_user.LastName <br/>



Here is the screenshot of the above codes:

No comments: