Ejemplo n.º 1
0
 public HomeModule()
 {
     Get["/"] = _ => {
         return(View["list_all_contacts.cshtml", ContactClass.GetAll()]);
     };
     Get["/contact/{id}"] = parameters => {
         return(View["view_contact.cshtml", ContactClass.GetById(parameters.id)]);
     };
     Get["/addContact"] = _ => {
         return(View["add_contact.cshtml"]);
     };
     Post["/contacts_deleted"] = _ => {
         ContactClass.DeleteAll();
         return(View["contacts_deleted.cshtml"]);
     };
     Post["/contact_created"] = _ => {
         string       name    = Request.Form["name"];
         string       phone   = Request.Form["phone"];
         string       address = Request.Form["address"];
         ContactClass c       = new ContactClass(name, phone, address);
         return(View["contact_created.cshtml", c]);
     };
 }