コード例 #1
0
        public async Task <Response> CreateResponseAsync()
        {
            UserFavoritesDto favorites = await favoritesService.AddUserFavoritesAsync(
                request.ChannelId, request.ChatId, request.ContactId, clientConnection.UserId.Value).ConfigureAwait(false);

            return(new FavoritesResponse(request.RequestId, new List <UserFavoritesVm>
            {
                UserFavoritesConverter.GetUserFavoriteVm(favorites, clientConnection.UserId.GetValueOrDefault())
            }));
        }
コード例 #2
0
        public static UserFavorite GetUserFavorite(UserFavoritesDto userFavorite)
        {
            if (userFavorite == null)
            {
                return(null);
            }

            return(new UserFavorite
            {
                ChannelId = userFavorite.ChannelId,
                ChatId = userFavorite.ChatId,
                ContactId = userFavorite.ContactId,
                UserId = userFavorite.UserId
            });
        }
コード例 #3
0
        public static UserFavoritesVm GetUserFavoriteVm(UserFavoritesDto userFavorites, long userId)
        {
            if (userFavorites == null)
            {
                return(null);
            }

            return(new UserFavoritesVm
            {
                Channel = ChannelConverter.GetChannelVm(userFavorites.Channel, userId),
                ChannelId = userFavorites.ChannelId,
                Chat = ChatConverter.GetChatVm(userFavorites.Chat),
                ChatId = userFavorites.ChatId,
                Contact = ContactConverter.GetContactVm(userFavorites.Contact),
                ContactId = userFavorites.ContactId,
                SerialNumber = userFavorites.SerialNumber
            });
        }