protected virtual void deleteObject(Type type, int id, BaseNoun parent = null) { if (parent != null && parent.Id <= 0) { throw new RESTAPIException("Parent noun (" + parent + ") must have a valid id"); } HttpWebResponse response = null; try { string restUrl = _serverURL + Constant.REST_BASE_PATH; if (parent != null) { restUrl += "/" + Noun.Base.BaseNoun.GetNoun(parent.GetType()) + "/" + parent.Id; } restUrl += "/" + Noun.Base.BaseNoun.GetNoun(type) + "/" + id; response = getRESTResponse(restUrl, "DELETE"); } finally { if (response != null) { response.Close(); } } }
public virtual void DeleteObject(BaseNoun noun, BaseNoun parent = null) { deleteObject(noun.GetType(), noun.Id, parent); }