public JsonResult GetAllCategories()
        {
            ProductCategoryApi categoryApi         = new ProductCategoryApi();
            List <ProductCategoryViewModel> result = categoryApi.GetActive();

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
        public JsonResult getListProduct()
        {
            ProductApi         productApi         = new ProductApi();
            ProductCategoryApi productCategoryApi = new ProductCategoryApi();
            ProductImageApi    productImageApi    = new ProductImageApi();

            //get parent product
            var products = productApi.Get().Where(q => q.ParentProductId == null);

            if (products == null)
            {
                return(Json(new
                {
                    status = new
                    {
                        success = false,
                        status = ConstantManager.STATUS_SUCCESS,
                        message = ConstantManager.MES_FAIL
                    },
                    data = new { }
                }, JsonRequestBehavior.AllowGet));
            }

            var data = (from p in products
                        select new
            {
                product_image_list = productImageApi.Get().Where(q => q.ProductId == p.ID).ToList(),
                product_id = p.ID,
                product_name = p.Name,
                price = p.Price,
                cat_id = p.CategoryID,
                size = p.Size,
                color = p.Color
            }).ToList();

            //get product category
            var productCategory = productCategoryApi.Get();
            //get cateId and cateName
            var category = from pc in productCategory
                           select new
            {
                cat_id   = pc.ID,
                cat_name = pc.Name
            };

            return(Json(new
            {
                status = new
                {
                    success = true,
                    status = ConstantManager.STATUS_SUCCESS,
                    message = ConstantManager.MES_SUCCESS,
                },
                data = new
                {
                    data = new
                    {
                        product_list = data,
                        product_category_list = category.ToList()
                    }
                }
            }, JsonRequestBehavior.AllowGet));
        }