public IndexModule(IIsopServer data) { Get["/"] = _ => { return(Negotiate .WithModel(data.GetModel()) .WithView("Index.html")); }; }
public IndexModule(IIsopServer data) { Get["/"] = _ => { return Negotiate .WithModel(data.GetModel()) .WithView("Index.html"); }; }
public ControllerModule(IIsopServer data) { Get["/{controller:Controller}"] = _ => { Models.Controller controller = data.GetController(_.controller); return(Negotiate .WithModel(controller) .WithView("Controller.html")); }; Get["/{controller:Controller}/{method}"] = _ => { Method method = data.GetControllerMethod(_.controller, _.method); return(Negotiate .WithModel(method) .WithView("ControllerAction.html")); }; Post["/{controller:Controller}/{method}"] = _ => { try { var method = data.GetControllerMethod(_.controller, _.method); IEnumerable <string> result = data.InvokeMethod(method, Request.Form); return(new YieldResultResponse(result)); } catch (TypeConversionFailedException e) { return(Negotiate .WithModel(ToModel(e)) .WithView("Errors.html") .WithStatusCode(400)); } catch (MissingArgumentException ex) { return(Negotiate .WithModel(ToModel(ex)) .WithView("Errors.html") .WithStatusCode(400)); } }; }
public ControllerModule(IIsopServer data) { Get["/{controller:Controller}"] = _ => { Models.Controller controller = data.GetController(_.controller); return Negotiate .WithModel(controller) .WithView("Controller.html"); }; Get["/{controller:Controller}/{method}"] = _ => { Method method = data.GetControllerMethod(_.controller, _.method); return Negotiate .WithModel(method) .WithView("ControllerAction.html"); }; Post["/{controller:Controller}/{method}"] = _ => { try { var method = data.GetControllerMethod(_.controller, _.method); IEnumerable<string> result = data.InvokeMethod(method, Request.Form); return new YieldResultResponse(result); } catch (TypeConversionFailedException e) { return Negotiate .WithModel(ToModel(e)) .WithView("Errors.html") .WithStatusCode(400); } catch (MissingArgumentException ex) { return Negotiate .WithModel(ToModel(ex)) .WithView("Errors.html") .WithStatusCode(400); } }; }
public MethodController(IIsopServer data) { _data = data; }
public ModelController(IIsopServer data) { _data = data; }
public ControllerSegmentConstraint(IIsopServer data) { _data = data; }