public static IHttpContext registrationCreate(IHttpContext context) { try { var data = Parsers.parseURLEncoded(context.Request.Payload); if (context.token().SID() != uint.Parse(data["UserId"])) { if (!context.token().hasPermission("registrations.write")) { context.Response.StatusCode = HttpStatusCode.NotFound; context.Response.SendResponse(""); return(context); } } else { if (!context.token().hasPermission("registrations.self.write") && !context.token().hasPermission("registrations.write")) { context.Response.StatusCode = HttpStatusCode.NotFound; context.Response.SendResponse(""); return(context); } } Registrations.add(uint.Parse(data["UserId"]), uint.Parse(data["StatusId"])); context.Response.SendResponse(""); } catch (Exception ex) { context.Response.StatusCode = HttpStatusCode.InternalServerError; context.Response.SendResponse(ex.Message); } return(context); }