public void DeleteTriplet(SingleTriple triple)
{
#if RELEASE // Authenticate only in RELEASE mode
ApiOperation(delegate(User user, Storage storage)
{
if (user == null)
{
SetStatusCode(HttpStatusCode.Unauthorized, "Anonymous users cannot delete triple");
}
else
{
if(GetSubjectOwner(storage, triple.Subject) == user.Id.ToString())
{
#else
using(var storage = new Storage())
#endif
try
{
SetStatusCode(storage.DeleteTriplet(triple.Subject, triple.Predicate, triple.Object) ? HttpStatusCode.OK : HttpStatusCode.NotModified, "");
}
catch (ArgumentException exc)
{
SetStatusCode(HttpStatusCode.BadRequest, exc.Message);
}
#if RELEASE
}
else
{
SetStatusCode(HttpStatusCode.Unauthorized, "Only subject owners can delete triple");
}
}
});
#endif
}