コード例 #1
0
 public ActionResult Edit([Bind(Include = "SubcategoryID,Name,CategoryID,UI,Image")] SubcategoryViewModel subcategory, int?imgId, int catId)
 {
     if (ModelState.IsValid)
     {
         subcategory.ImageID    = imgId;
         subcategory.CategoryID = catId;
         _subcategoryService.Edit(subcategory);
         return(RedirectToAction("IndexAdmin", new { id = subcategory.CategoryID }));
     }
     ViewBag.CategoryID = new SelectList(_categoryService.GetAll(), "CategoryID", "Name", subcategory.CategoryID);
     return(View(subcategory));
 }