MonoRail vs ASP.NET MVC Take #1 HTTP verbs
Along came ASP.NET MVC although I am not the fan of ASP.NET MVC but it doens’t heard reading ASP.NET free chapter (nerddinner) and I did learn a few tricks, I will try my best to map concept between the two framework now let see
Why differentiate via HTTP verbs? read the book and find out, but here the deal
- ASP.NET MVC [AcceptVerbs(HttpVerbs.Post)]
- and [AccessibleThrough(Verb.Post)] in MonoRail
// GET: /Payroll/Delete/2
public void Delete([ARFetch("id"}] Payroll payroll){
if (payroll == null)
{
RenderView("InvalidRequest");
}
else
{
PropertyBag["payroll"] = payroll;
RenderView("DeleteConfirm");
}
}
// POST: /Payroll/Delete/2
[AccessibleThrough(Verb.Post)]
public void Delete([ARFetch("id"}] Payroll payroll, bool confirm){
if (payroll == null)
{
RenderView("InvalidRequest");
}
else
{
if(confirm){
..... // drop the record off the database
..... // do whatever you want.
}
else
{
RedirectToAction("Delete", "id" + payroll.Id);
}
}
}
MonoRail Rock!

if (payroll == null)
Ken Egozi
March 26, 2009 at 1:04 pm
ah! :) you got me thanks Ken.
Chorn Sokun
March 26, 2009 at 1:25 pm