Ejemplo n.º 1
0
        public ActionResult Index()
        {
            Category model = new Category();

            model.CategoryList = CategoryBusiness.GetCategories();
            return(View(model));
        }
Ejemplo n.º 2
0
        // Load Categories
        public async Task <ActionResult> LoadCategories()
        {
            CategoryViewModel viewmodel = new CategoryViewModel();

            viewmodel.CategoryList = await CategoryBusiness.GetCategories();

            return(PartialView("Categories", viewmodel));
        }
Ejemplo n.º 3
0
        // Display Index
        public async Task <ActionResult> Index()
        {
            CategoryViewModel viewmodel = new CategoryViewModel();

            viewmodel.CategoryList = await CategoryBusiness.GetCategories();

            return(View(viewmodel));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 获取所有的分类,包括item 和 pictures
        /// </summary>
        /// <returns></returns>
        public ActionResult GetCategories()
        {
            var categories = _category.GetCategories();
            var items      = _item.GetItems();
            var pictures   = _picture.GetPictures();

            for (var i = 0; i < items.Count; i++)
            {
                items[i].EPictures = pictures.Where(x => x.EItemId == items[i].EId).ToList();
            }

            for (var i = 0; i < categories.Count; i++)
            {
                categories[i].EItems = items.Where(x => x.ECategoryId == categories[i].EId).ToList();
            }

            //处理级别
            var firstLevelCategories = categories.Where(x => string.IsNullOrWhiteSpace(x.EParentId)).ToList();

            firstLevelCategories = firstLevelCategories.OrderBy(x => int.Parse(x.EName.Replace("-", ""))).ToList();

            firstLevelCategories.ForEach(x =>
            {
                x.EName          = GetYearName(x.EName);
                x.ESubCategories = categories.Where(y => y.EParentId == x.EId).ToList();
                x.ESubCategories = x.ESubCategories?.OrderBy(y => int.Parse(y.EName.Replace("-", ""))).ToList();
                x.ESubCategories.ForEach(m =>
                {
                    m.EName  = GetMonthName(m.EName);
                    m.EItems = m.EItems?.OrderBy(y => DateTime.Parse(y.EName)).ToList();
                });
            });


            return(Json(firstLevelCategories, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Método que consulta todos los registros de la entidad
        /// </summary>
        /// <returns>Lista de registros</returns>
        public async Task <List <Category> > GetCategories()
        {
            List <Category> categories = categoryBusiness.GetCategories();

            return(categories);
        }
Ejemplo n.º 6
0
 private void ShowCategories()
 {
     dataGridView1.DataSource = CategoryBusiness.GetCategories();
 }
Ejemplo n.º 7
0
 //Ekelenen kategorileri formda görmek için:
 public void getCategories()
 {
     dataGridViewCategories.DataSource = categoryBusiness.GetCategories();
 }