void applyProfileFromURI(BORequest boReq, string profile, bool rawXml = false, bool xmlSchema = false) { if (!string.IsNullOrEmpty(profile)) { if (boReq.connection == null) { boReq.connection = new ConnectionParams { Profile = profile } } ; else if (string.IsNullOrEmpty(boReq.connection.Profile)) { boReq.connection.Profile = profile; } } if (rawXml) { boReq.rawXml = rawXml; } if (xmlSchema) { boReq.xmlSchema = xmlSchema; } }
void checkBoReqParameter(BORequest boReq) { if (boReq == null) { throw new Exception("The body is missing or not formatted correctly. Maybe just a comma is missing between two attributes."); } }
public BOResult Post([FromBody] BORequest boReq, string name) { try { checkBoReqParameter(boReq); return(SAPB1.BORequest(q: boReq, name: name, id: null, post: true, result: new BOResult(Request))); } catch (Exception e) { return(handleException(e)); } }
public BOResult Put([FromBody] BORequest boReq, string name, string id, string profile = null) { try { checkBoReqParameter(boReq); applyProfileFromURI(boReq, profile); return(SAPB1.BORequest(q: boReq, name: name, id: id, put: true, result: new BOResult(Request))); } catch (Exception e) { return(handleException(e)); } }
public BOResult Get(/*[FromBody]BORequest boReq,*/ string name, string id, string profile = null, bool rawXml = false, bool xmlSchema = false) { try { BORequest boReq = new BORequest { connection = new ConnectionParams { Profile = profile } }; applyProfileFromURI(boReq, profile, rawXml, xmlSchema); checkBoReqParameter(boReq); return(SAPB1.BORequest(q: boReq, name: name, id: id, result: new BOResult(Request))); } catch (Exception e) { return(handleException(e)); } }
public BOResult Delete(/*BORequest boReq,*/ string name, string id, string profile = null) { try { //checkBoReqParameter(boReq); BORequest boReq = new BORequest { connection = new ConnectionParams { Profile = profile } }; applyProfileFromURI(boReq, profile); return(SAPB1.BORequest(q: boReq, name: name, id: id, delete: true, result: new BOResult(Request))); } catch (Exception e) { return(handleException(e)); } }