Ejemplo n.º 1
0
        public async Task<Response<JsonObject>> PostAsync(JsonObject json)
        {
            if (json == null)
                throw new ArgumentNullException("json");

            var table = await DefineTable().ConfigureAwait(false);
            var entity = json.ToCyanEntity();
            var result = await table.Insert(entity).ConfigureAwait(false);

            return new Response<JsonObject>(HttpStatusCode.Created, result.ToJsonObject());
        }
Ejemplo n.º 2
0
        public async Task<Response<JsonObject>> DeleteAsync(JsonObject json)
        {
            if (json == null)
                throw new ArgumentNullException("json");

            var table = await DefineTable().ConfigureAwait(false);
            var entity = json.ToCyanEntity();
            var result = new JsonObject();

            await table.Delete(entity).ConfigureAwait(false);

            return new Response<JsonObject>(HttpStatusCode.OK, result);
        }