예제 #1
0
        public async Task <IActionResult> CounterState(Guid id)
        {
            var grain = this.grainClient.GetGrain <ICounterGrain>(id);

            try
            {
                var state = (await grain.GetState()) ?? new CounterState();
                return(Ok(state));
            }
            catch (Exception e)
            {
                return(StatusCode(500, ApiResult.FromException(e, env.IsDevelopment())));
            }
        }
예제 #2
0
        public async Task <ActionResult> StopCounter()
        {
            var grain = this.grainClient.GetGrain <ICounterGrain>(this.sessionId);

            try
            {
                await grain.StopCounterTimer();

                return(Ok());
            }
            catch (Exception e)
            {
                return(StatusCode(500, ApiResult.FromException(e, env.IsDevelopment())));
            }
        }