Example #1
0
 public bool Delete(WebServer server, HttpListenerContext context)
 {
     try
     {
         var model = context.ParseJson<Entry>();
         // TODO: Complete
         return true;
     }
     catch (Exception ex)
     {
         return HandleError(context, ex);
     }
 }
Example #2
0
        public bool Post(WebServer server, HttpListenerContext context)
        {
            try
            {
                var model = context.ParseJson<Entry>();
                LocalCdn.AddEntry(model.Url);

                return true;
            }
            catch (Exception ex)
            {
                return HandleError(context, ex);
            }
        }
Example #3
0
        public bool GetPeople(WebServer server, HttpListenerContext context)
        {
            try
            {
                var model = context.ParseJson<GridDataRequest>();

                return context.JsonResponse(model.CreateGridDataResponse(People.AsQueryable()));
            }
            catch (Exception ex)
            {
                // here the error handler will respond with a generic 500 HTTP code a JSON-encoded object
                // with error info. You will need to handle HTTP status codes correctly depending on the situation.
                // For example, for keys that are not found, ou will need to respond with a 404 status code.
                return HandleError(context, ex);
            }
        }