public WithGuid ( System.Guid aGuid ) : AObject | ||
aGuid | System.Guid | |
return | AObject |
protected void InitializeDelete(AObjects aObjects, string aPath) { this.RequiresAuthentication(); Delete["/" + aPath + "/{guid:guid}", true] = async(_, ct) => { try { var obj = aObjects.WithGuid(Guid.Parse(_.guid)); if (obj != null) { obj.Parent.Remove(obj); return CreateSuccessResponseAndUpdateApiKey(_.format); } return CreateErrorResponseAndUpdateApiKey(HttpStatusCode.NotFound); } catch (Exception ex) { return CreateErrorResponseAndUpdateApiKey(ex.Message); } }; }
protected void InitializeGet(AObjects aObjects, string aPath) { this.RequiresAuthentication(); Get["/" + aPath + "/{guid:guid}", true] = async(_, ct) => { try { var obj = aObjects.WithGuid(Guid.Parse(_.guid)); if (obj != null) { return CreateSuccessResponseAndUpdateApiKey(Helper.XgObjectToNancyObject(obj)); } return CreateErrorResponseAndUpdateApiKey(HttpStatusCode.NotFound); } catch (Exception ex) { return CreateErrorResponseAndUpdateApiKey(ex.Message); } }; }