예제 #1
0
        public async Task <IActionResult> Get(Guid postId)
        {
            if (postId == Guid.Empty)
            {
                ModelState.AddModelError(nameof(postId), "value is empty");
                return(BadRequest(ModelState.CombineErrorMessages()));
            }

            var(hits, likes) = await _statistics.GetStatisticAsync(postId);

            return(Ok(new { Hits = hits, Likes = likes }));
        }
예제 #2
0
        public async Task <IActionResult> Get([NotEmpty] Guid postId)
        {
            var(hits, likes) = await _statistics.GetStatisticAsync(postId);

            return(Ok(new { Hits = hits, Likes = likes }));
        }