示例#1
0
 public void ProcessRequest(HttpContext context)
 {
     try
     {
         PersonModel.InitDB();
         RestRequest r = new RestRequest(context);
         r.Controller.Dispatch(r).Return();
     }
     catch (Exception e)
     {
         new Response(false, e.Message).Return();
     }
 }
示例#2
0
 public Response Dispatch(RestRequest request)
 {
     this.request = request;
     switch(this.request.Method)
     {
         case "GET":
             return this.View();
         case "POST":
             return this.Create();
         case "PUT":
             return this.Update();
         case "DELETE":
             return this.Destroy();
         default:
             throw new InvalidOperationException("Incorrect Http verb");
     }
 }