예제 #1
0
        public async Task OnCommentaryActionAsync(CommentaryNotification info)
        {
            var currentDayStatistic = await _dbAccess.GetBlogDayStatisticAsync(DateTime.UtcNow.Date);

            var countDelta = info.Action switch
            {
                CommentaryAction.CREATED => 1,
                CommentaryAction.DELETED => - 1,
                _ => throw new NotSupportedException()
            };

            currentDayStatistic.CommentariesCount += countDelta;

#warning save changes should not be here
            await _db.SaveChangesAsync();
        }