Beispiel #1
0
        private FavoriteCollectionResponse Get(float version, int userId, PagerRequest pagerRequest, CoordinateInfo coordinate, FavoriteSortOrder sortOrder, SourceType sourceType)
        {
            FavoriteCollectionResponse response;
            int totalCount;

            if (version >= 2.1)
            {
                var entitys = _favoriteRepository.Get(userId, pagerRequest, out totalCount, sortOrder, sourceType);

                var list = MappingManager.FavoriteCollectionResponseMapping(entitys, coordinate);

                response = new FavoriteCollectionResponse(pagerRequest, totalCount)
                {
                    Favorites = list
                };
            }
            else
            {
                var entitys = _favoriteRepository.GetPagedList(userId, pagerRequest, out totalCount, sortOrder, sourceType);

                response            = MappingManager.FavoriteCollectionResponseMapping(entitys, coordinate);
                response.Index      = pagerRequest.PageIndex;
                response.Size       = pagerRequest.PageSize;
                response.TotalCount = totalCount;
            }

            return(response);
        }
        /// <summary>
        /// find user info
        /// </summary>
        /// <param name="favoriteId"></param>
        /// <param name="specwayId"></param>
        /// <returns></returns>
        public FavoriteDTO FindFavorite(Guid favoriteId, Guid accountId)
        {
            //recover existing favoriteId and map
            var favorite = _favoriteRepository.Get(favoriteId, accountId);

            if (favorite != null) //adapt
            {
                return(favorite.ProjectedAs <FavoriteDTO>());
            }
            else
            {
                return(null);
            }
        }