Example #1
0
        public PartialViewResult Menu(string category = null, string name = null, string cost = null)
        {
            ViewBag.SelectedCategory = name;
            ViewBag.SelectedCost     = cost;
            ViewBag.Category         = category;
            MenuViewModel model = new MenuViewModel
            {
                CategoryName = serviceCatogory.GetFindByNameItem(category),
                GetCategory  = serviceCatogory.GetCategory(category)
            };

            //IEnumerable<string> CategoryName = serviceCatogory.GetFindByNameItem(category);
            //serviceItem.GetByCategoryName();
            return(PartialView(model));
        }
Example #2
0
        public ActionResult Browse(string category, string name = null, int page = 1, string cost = null)
        {
            int PageSize = 1;
            IEnumerable <ItemDTO> datas;

            switch (cost)
            {
            case "to-cheap":
                datas = serviceItem.SortedDatas(category);
                break;

            default:
                datas = serviceItem.DatasMatchingCategories(page, PageSize, name, category);
                break;
            }
            var mapper = new MapperConfiguration(cfg => cfg.CreateMap <ItemDTO, ItemViewModel>()).CreateMapper();

            ViewBag.ItemName = name;

            SortCategoryViewModel _model = new SortCategoryViewModel
            {
                CategoryModel    = serviceCategory.GetCategory(category),
                DescriptionModel = serviceDescription.GetDescriptionCategory(category),
                CurrentCategory  = name,
                Info             = new InfoOfPage
                {
                    CurrentPage  = page,
                    ItemsPerPage = PageSize,
                    TotalItems   = serviceItem.Count(name, category)
                },
                Items = mapper.Map <IEnumerable <ItemDTO>, IList <ItemViewModel> >(datas)
            };

            //var categoryModel = serviceCategory.GetCategory(category);
            return(View(_model));
        }