Esempio n. 1
0
        public async Task Consume(ConsumeContext <CommentMessage> context)
        {
            var data = context.Message;

            Console.WriteLine($"{data.Content}");

            var comment = new Comment()
            {
                CommentId   = data.CommentId,
                BuyerId     = data.BuyerId,
                FullName    = data.FullName,
                UserId      = data.UserId,
                BookId      = data.BookId,
                Rating      = data.Rating,
                Content     = data.Content,
                CreatedDate = data.CreatedDate
            };
            await _context.AddAsync(comment);

            await _context.SaveChangesAsync();
        }