Ejemplo n.º 1
0
        //scraper
        public string Scrape(ScrapRequest model)
        {
            //var html = @"https://www.yelp.com/biz/mo-ran-gak-restaurant-garden-grove";

            var html = @model.Url;

            HtmlWeb web = new HtmlWeb();

            var htmlDoc = web.Load(html);

            var node = htmlDoc.DocumentNode.SelectSingleNode("//head/title");

            return(node.InnerHtml);
            //Console.WriteLine(node.InnerHtml);
            //    Console.ReadLine();
        }
Ejemplo n.º 2
0
        public HttpResponseMessage Scrape(ScrapRequest model)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
                }

                string locationresult = _locationService.Scrape(model);


                return(Request.CreateResponse(HttpStatusCode.OK, locationresult));
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex.Message));
            }
        }
Ejemplo n.º 3
0
 public IEnumerable <Scrap> GetScrapList(ScrapRequest request = null)
 {
     request = request ?? new ScrapRequest();
     using (var dbContext = new AuditDbContext())
     {
         IQueryable <Scrap> Scraps = dbContext.Scraps;
         if (request != null)
         {
             if (!string.IsNullOrEmpty(request.Code))
             {
                 Scraps = Scraps.Where(u => u.Code.Contains(request.Code));
             }
             if (request.SeqID != 0)
             {
                 Scraps = Scraps.Where(u => u.SeqID == request.SeqID);
             }
         }
         return(Scraps.OrderByDescending(u => u.ID).ToPagedList(request.PageIndex, request.PageSize));
     }
 }
Ejemplo n.º 4
0
        //
        // GET: /Audit/Scrap/

        public ActionResult Index(ScrapRequest request)
        {
            var result = this.AuditService.GetScrapList(request);

            return(View(result));
        }