Exemplo n.º 1
0
        private async static Task <string> RedirectUrl(string Url)
        {
            var RedirectorModel = await GetUrls.Url(Url);

            var lastLink = RedirectorModel.Redirects.Select(link => link.RedirectUri).Last();

            return(lastLink);
        }
Exemplo n.º 2
0
        public IActionResult Timed(GetUrls search)
        {
            var itemSearch  = search.NewSearch;
            var itemName    = search.ItemName;
            var newestPrice = search.ItemPrice;
            var getDate     = DateTime.Now;

            if (DateTime.Now.ToShortTimeString() == "12:18 AM")
            {
                string url = $"https://www.ebay.com/sch/i.html?_nkw=sefer+torah";

                var web      = new HtmlWeb();
                var document = web.Load(url);

                var listingTitle = document.DocumentNode.Descendants("h3")
                                   .Where(node => node.GetAttributeValue("class", "")
                                          .Equals("s-item__title")).FirstOrDefault().GetDirectInnerText();

                var price = document.DocumentNode.Descendants("span")
                            .Where(node => node.GetAttributeValue("class", "")
                                   .Equals("s-item__price")).FirstOrDefault().GetDirectInnerText();

                var idSet = search.NewSearch;

                if (listingTitle == null || price == null)
                {
                    return(View("GetPage"));
                }

                itemName = listingTitle.ToString();

                var itemPrice    = price.ToString();
                var newItemPrice = itemPrice.Replace("$", "");
                decimal.TryParse(newItemPrice, out newestPrice);

                var theModel = new GetUrls
                {
                    ItemName  = itemName,
                    ItemPrice = newestPrice,
                    NewSearch = itemSearch,
                    Date      = getDate
                };
                var dbTable = _repository.GetUrls;

                var dataAdded = dbTable.Add(theModel);
                _repository.SaveChanges();

                return(View(theModel));
            }
            return(null);
        }
Exemplo n.º 3
0
 public IActionResult FindItemOnChart(GetUrls getUrl)
 {
     return(View());
 }
Exemplo n.º 4
0
        public IActionResult Chart(GetUrls getUrl)
        {
            var viewInfo = _repository.GetUrls.Where(i => i.NewSearch == getUrl.NewSearch);

            return(View(viewInfo));
        }