Example #1
0
        public WishModel Handle(AddWishRequest message)
        {
            var wishListId = context.WishLists.Single(wl => wl.UserId == message.UserId).Id;
            var wish       = new Wish {
                Title      = message.Title,
                WishListId = wishListId
            };

            context.Add(wish);
            context.SaveChanges();
            clientNotifier.RefreshListAsync(wishListId);
            return(mapper.Map <WishModel>(wish));
        }
Example #2
0
        public ChatMessageModel Handle(AddMessageRequest request)
        {
            var chatMessage = new ChatMessage
            {
                Text       = request.Text,
                UserId     = request.UserId,
                WishListId = request.WishListId
            };

            context.Add(chatMessage);
            context.SaveChanges();
            chatMessage.User = context.GetOrDie <User>(request.UserId);
            _clientNotifier.RefreshListAsync(request.WishListId, request.UserId);
            return(mapper.Map <ChatMessageModel>(chatMessage));
        }