예제 #1
0
        public void OnGet(string url, long fromDateTicks)
        {
            var prices = CheckWatches.GetForWatch(WebUtility.UrlDecode(url), new DateTime(fromDateTicks)).Take(30);

            Labels  = prices.Select(w => w.When.Month + "/" + w.When.Day);
            Amounts = prices.Select(w => w.Price);
            Name    = prices.First().Name;
        }
예제 #2
0
        public void OnGet(bool old = false)
        {
            var prices = new List <WatchPriceDto>();
            var data   = CheckWatches.GetPriceSummary()
                         .Where(d => old ^ CheckWatches.Urls.Contains(d.Url));

            foreach (var w in data)
            {
                var next = data.Where(d => d.Url == w.Url && d.When < w.When)
                           .OrderByDescending(d => d.When)
                           .FirstOrDefault();
                prices.Add(new WatchPriceDto
                {
                    Watch        = w,
                    PriceReduced = next != null && w.Price < next.Price
                });
            }
            WatchPriceDtos = prices;
        }
예제 #3
0
 public IActionResult Get()
 {
     CheckWatches.UpdatePrices();
     return(RedirectToPage("/Index"));
 }