コード例 #1
0
 public IActionResult Register(int?catId = null, int?PrcId = null)
 {
     ViewBag.Categories = new SelectList(_sellerService.GetCategories().Data, "CategoryId", "Name", catId);
     //if (ViewBag.SubCategories == null)
     //{
     //    ViewBag.SubCategories = _sellerService.GetSubCategories(null).Data;
     //}
     //if (catId!=null)
     //{
     //    ViewBag.SubCategories = _sellerService.GetSubCategories(catId).Data;
     //}
     //if (catId!=null)
     //{
     //    ViewBag.SubCategories = new SelectList(_sellerService.GetSubCategories(catId).Data, "SubId", "SubName");
     //}
     //ViewBag.Provinces = new SelectList(_sellerService.GetProvinces().Data, "Id", "Name", PrcId);
     //if (PrcId != null)
     //{
     //    ViewBag.Cities = new SelectList(_sellerService.GetCities(PrcId).Data, "Id", "Name");
     //}
     return(View());
 }
コード例 #2
0
        public IActionResult AddProduct(int?catId = null, int?subcatId = null)
        {
            string UserId = ClaimUtility.GetUserId(HttpContext.User);
            string _catId = _sellerService.GetSellerCategory(UserId);

            ViewBag.Categories = new SelectList(_sellerService.GetCategories().Data, "CategoryId", "Name", _catId);

            ViewBag.SubCategories = new SelectList(_sellerPanelService.GetSubCategories(int.Parse(_catId)).Data, "SubId", "SubName", subcatId);

            if (subcatId != null)
            {
                ViewBag.Products = new SelectList(_sellerPanelService.GetProduct(subcatId).Data, "ProductId", "ProductName");
            }
            return(View());
        }