Пример #1
0
        public async Task <IActionResult> AutoAdd()
        {
            var services = ParsingServicesManager.GetListServices(_context);
            var state    = new CostsAnalyse.Services.Managers.StateManager().RecoverState();

            if (state == null)
            {
                state = new ParseState(1, Store.Rozetka);
            }
            switch (state.Type)
            {
            case Store.Rozetka:
                new RozetkaPageDriver(_context).GetProducts(state.index);
                goto case Store.Foxtrot;

            case Store.Foxtrot:
                new FoxtrotPageDriver(_context).GetProducts(state.index);
                goto case Store.Eldorado;

            case Store.Eldorado:
                throw new NotImplementedException();
                goto case Store.Comfy;

            case Store.Comfy:
                throw new NotImplementedException();
            }
            return(new JsonResult("Ok"));
        }
Пример #2
0
        public void GetProducts(int page = 0)
        {
            var pages         = GetPages();
            var _stateManager = new CostsAnalyse.Services.Managers.StateManager();

            for (; page < pages.Count; page++)
            {
                _stateManager.SaveState(new ParseState(page, Store.Rozetka));
                ParseProductsFromPage(pages.GetItemByIndex(page));
            }
        }