Exemplo n.º 1
0
        //GET: Edit
        public async Task <IActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var subcategory = await _subCategoryService.FindByIdSync(id.Value);

            if (subcategory == null)
            {
                return(NotFound());
            }

            SubCategoryAndCategoryViewModel model = new SubCategoryAndCategoryViewModel()
            {
                CategoryList    = await _categoryService.FindAllAsync(),
                SubCategory     = subcategory,
                SubCategoryList = await _subCategoryService.FindAllNameSCAsync(),
                StatusMessage   = "",
            };

            return(View(model));
        }