Exemplo n.º 1
0
        /*public ActionResult IndexSima()
        {
            var Page = new ArticlePageModel();
            //var items = _itemService.GetAllItems();
            var categories = _categoryService.GetAllCategory();

            Page.ItemList = _itemService.GetAllItems();

            Page.AvailableCategories = categories.Select(c => new CategoryModel()
            {
                Id = c.Id,
                Name = c.Name
            }).ToList();

            return View("Index", Page);
        }*/
        // GET: Article
        public ActionResult Index(int? page = 1, string sort = "Number", string sortdir = "ASC")
        {
            var Page = new ArticlePageModel();

            Page.ItemList = _itemService.GetAllItems(page, sort, sortdir);
            Page.ItemListCount = _itemService.GetDbSize();

            Page.SelectedCategories = new List<CategoryModel>();
            Page.AvailableCategories = _categoryService.GetAllCategory();

            return View("Index2", Page);
        }
Exemplo n.º 2
0
        public ActionResult Search(ArticlePageModel Page)
        {
            Page.ItemList = _itemService.Search(Page.SearchNumber, Page.SearchName, Page.SearchDescription,
                                                Page.SearchMinPrice, Page.SearchMaxPrice, Page.PostedCategories);

            Page.AvailableCategories = _categoryService.GetAllCategory();
            if (Page.PostedCategories != null && Page.PostedCategories.CategoryId.Any())
            {
                Page.SelectedCategories = Page.AvailableCategories
                    .Where(x => Page.PostedCategories.CategoryId.Any(s => x.Id.ToString().Equals(s)))
                    .ToList();
            }

            return View("Index2", Page);
            //return RedirectToAction("Index", new RouteValueDictionary( new { controller = "Article", action = "Index", Page }));
        }