#include "AddressBook.h" SKYLARK(HomePage, "") { SqlBool where; String s = http["search"]; if(!IsNull(s)) { s << '%'; where = Like(FIRSTNAME, s) || Like(LASTNAME, s) || Like(EMAIL, s); } http("PERSON", Select(ID, FIRSTNAME, LASTNAME, EMAIL).From(PERSON) .Where(where).OrderBy(LASTNAME, FIRSTNAME)) .RenderResult("AddressBookWeb/Index"); } SKYLARK(CatchAll, "**") { http.Redirect(HomePage); } SKYLARK(SubmitNew, "submit/create:POST") { SQL * http.Insert(PERSON); http.Redirect(HomePage); } SKYLARK(New, "person/create") { http("ACTION", SubmitNew) .RenderResult("AddressBookWeb/Dialog"); } SKYLARK(SubmitEdit, "submit/edit/*:POST") { SQL * http.Update(PERSON).Where(ID == http.Int(0)); http.Redirect(HomePage); } SKYLARK(Edit, "person/edit/*") { int id = http.Int(0); http (Select(FIRSTNAME, LASTNAME, EMAIL).From(PERSON).Where(ID == id)) ("ID", id) ("ACTION", SubmitEdit, id) .RenderResult("AddressBookWeb/Dialog"); } SKYLARK(Delete, "person/delete/*") { SQL * Delete(PERSON).Where(ID == atoi(http[0])); http.Redirect(HomePage); }