Ejemplo n.º 1
0
        public ICollection <int> GetAllItems()
        {
            logger.LogInformation("Items Manager doing stuff");
            var items = apiConnector.ApiCall("v2/items");

            return(apiMapper.MapTo <List <int> >(items));
        }
Ejemplo n.º 2
0
        public int SessionValueHighestOrder(ICollection <TrackerItem> trackerSession)
        {
            logger.LogInformation("into trackerManager");
            //var items = trackerParser.ParseTrackerSession(trackerSession);

            var itemIdList = String.Join(",", trackerSession.Select(a => a.Id));

            var result = apiConnector.ApiCall($"v2/commerce/prices?ids={itemIdList}");

            var listings = apiMapper.MapTo <List <ItemOrderValue> >(result);

            var total = 0;

            foreach (var item in trackerSession)
            {
                var listing = listings.FirstOrDefault(a => a.Id == item.Id);
                if (listing != null)
                {
                    total += listing.Sells.UnitPrice * item.Amount;
                }
            }

            return(total);
        }