Exemplo n.º 1
0
        public async Task <LikeOfferResponse> Handle(LikeOfferRequest request, CancellationToken cancellationToken)
        {
            var(isLiked, like) = await favoritesService.LikeOffer(request.OfferId);

            if (isLiked)
            {
                var notification = await notifier.Push(NotificationMessages.OfferFollowMessage(like.User.UserName, request.OfferId), like.Offer.OwnerId);

                await hubManager.Invoke(SignalrActions.NOTIFICATION_RECEIVED, like.Offer.OwnerId, mapper.Map <NotificationDto>(notification));
            }

            return(new LikeOfferResponse {
                IsLiked = isLiked, Like = mapper.Map <OfferLikeDto>(like)
            });
        }