コード例 #1
0
        public async Task <IActionResult> ResetHistory(
            [HttpTrigger(AuthorizationLevel.Anonymous, "delete", Route = "bins/{binId}/reset")] HttpRequest req,
            [DurableClient] IDurableClient client,
            string binId)
        {
            var bin = this._helper.GetBin(binId);

            await client.SignalEntityAsync <IBin>(bin, o => o.Reset());

            var nav = BinNavigation.Parse(binId, req.IsHttps, req.Host.ToString());

            var result = new JsonObjectContentResult(HttpStatusCode.Accepted, nav);

            return(result);
        }
コード例 #2
0
        public async Task <IActionResult> GetHistory(
            [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "bins/{binId}/history")] HttpRequest req,
            [DurableClient] IDurableClient client,
            string binId)
        {
            var bin = this._helper.GetBin(binId);

            var entity = await client.ReadEntityStateAsync <Bin>(bin);

            var payload = entity.EntityState;

            payload.Navigation = BinNavigation.Parse(binId, req.IsHttps, req.Host.ToString());

            var result = new JsonObjectContentResult(HttpStatusCode.OK, payload);

            return(result);
        }
コード例 #3
0
        public async Task <IActionResult> CreateBin(
            [HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "bins")] HttpRequest req,
            [DurableClient] IDurableClient client)
        {
            // Create bin reference
            var binId = Guid.NewGuid();
            var bin   = this._helper.GetBin(binId);

            // Create bin
            await client.SignalEntityAsync <IBin>(bin, o => o.Add(null));

            // Create return.
            var nav = BinNavigation.Parse(binId, req.IsHttps, req.Host.ToString());

            var result = new JsonObjectContentResult(HttpStatusCode.Created, nav);

            return(result);
        }