Example #1
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SubcategoryViewModel subcategory = _subcategoryService.GetById((int)id);

            if (subcategory == null)
            {
                return(HttpNotFound());
            }
            ViewBag.CategoryID = new SelectList(_categoryService.GetAll(), "CategoryID", "Name", subcategory.CategoryID);
            return(View(subcategory));
        }