예제 #1
0
        public async Task <IActionResult> Get()
        {
            try
            {
                await _counterRepository.Initialize();

                var state = await _counterRepository
                            .GetLast();

                if (state == null)
                {
                    return(NotFound());
                }

                return(Ok(new CounterState
                {
                    Count = state.Count,
                    CreatedAt = state.CreatedAt,
                    Store = _storeType
                }));
            }
            catch (Exception ex)
            {
                return(StatusCode(500, ex.Message));
            }
        }