Exemplo n.º 1
0
        /// <summary>
        /// Requests information about a user's collection
        /// </summary>
        /// <param name="collectionRequest">Details of the request</param>
        /// <returns>Details of the user's collection</returns>
        public Collection.Return GetCollection(Collection.Request collectionRequest)
        {
            if (string.IsNullOrEmpty(collectionRequest.UserName))
            {
                throw new ArgumentException("Null or empty username in collectionRequest");
            }

            return(CallBGG <Collection.Return>("collection", collectionRequest));
        }
Exemplo n.º 2
0
        public List <Collection.Item> GetCollectionSorted(Collection.Request collectionRequest)
        {
            var collection = GetCollection(collectionRequest);

            foreach (var item in collection.Items.Where(item => item.Version != null))
            {
                // item.Size.Width = Math.Abs(item.Version.Item.Width.value) > 0.1 ? item.Version.Item.Width.value : 0.1;
                var width = Math.Abs(item.Version.Item.Width.value) > 0.1 ? item.Version.Item.Width.value : 0.1;;
                // item.Size.Length = Math.Abs(item.Version.Item.Length.value) > 0.1 ? item.Version.Item.Length.value : 0.1;
                var length = Math.Abs(item.Version.Item.Length.value) > 0.1 ? item.Version.Item.Length.value : 0.1;
                // item.Size.Depth = Math.Abs(item.Version.Item.Depth.value) > 0.1 ? item.Version.Item.Depth.value : 0.1;
                var depth = Math.Abs(item.Version.Item.Depth.value) > 0.1 ? item.Version.Item.Depth.value : 0.1;

                item.Volume = width * length * depth;
            }

            return(collection.Items.OrderByDescending(item => item.Volume).ThenBy(n => n.Name).ToList());
        }