Пример #1
0
        //public IActionResult Search(string q)
        //{
        //    return Search(q, 1);
        //}

        public IActionResult Search(string q, int p)
        {
            IExternalService externalService = new ExternalServiceMercadoLibre();
            ILoggerService   loggerService   = new Log4NetLoggerService();
            IItem            model           = new Item(externalService, loggerService);

            loggerService.Action("UserX", "VER CCOMO OBTENEMOS ESTO", System.Reflection.MethodBase.GetCurrentMethod().Name, DateTime.Now);

            SearchResultEntity searchResult = model.SearchItems(q, (p - 1) * _itemsPerPage, _itemsPerPage);

            if (searchResult != null && searchResult.results.Count > 0)
            {
                return(View(searchResult.results));
            }
            else
            {
                return(null);
            }
        }
Пример #2
0
        // GET: Item
        public IActionResult Item(string id)
        {
            IExternalService externalService = new ExternalServiceMercadoLibre();
            ILoggerService   loggerService   = new Log4NetLoggerService();
            IItem            model           = new Item(externalService, loggerService);

            loggerService.Action("UserX", "VER CCOMO OBTENEMOS ESTO", System.Reflection.MethodBase.GetCurrentMethod().Name, DateTime.Now);

            ItemEntity item = model.GetItem(id);

            if (item != null)
            {
                return(View(item));
            }
            else
            {
                return(null);
            }
        }