Example #1
0
        public static OverviewData FromResultItem(OverviewData inherit, OverviewResponseItem item)
        {
            if (inherit == null)
            {
                return(new OverviewData
                {
                    ItemId = item.ItemId,
                    OpenListing = item.OpenListing,
                    Demand = item.Demand,
                    UpdateTime = item.ReportTime,
                    World = item.World,
                });
            }

            if (item.ItemId != inherit.ItemId)
            {
                return(inherit);
            }

            return(new OverviewData
            {
                ItemId = item.ItemId,
                OpenListing = item.OpenListing + inherit.OpenListing,
                Demand = item.Demand + inherit.Demand,
                UpdateTime = item.ReportTime > inherit.UpdateTime ? item.ReportTime.LocalTime : inherit.UpdateTime,
                World = 0,
            });
        }
Example #2
0
        public static OverviewResponseItem FromDb(this OverviewData item)
        {
            var result = new OverviewResponseItem();
            {
                result.ItemId = item.ItemId;
                result.OpenListing = item.OpenListing;
                result.Demand = item.Demand;
                result.World = item.World;
                result.ReportTime = item.ReportTime;
            }

            return result;
        }