public IActionResult UpdateSubCategory(SubCategoryVM subCategoryVM, int id) { User currentAdmin = HttpContext.Session.Get <User>("currentUser"); SubCategory subCategory = subCategoryBLL.Get(id).Data; try { if (ModelState.IsValid) { subCategory.CategoryName = subCategoryVM.SubCategoryName; subCategory.Description = subCategoryVM.Overview; subCategory.CategoryID = subCategoryVM.CatID; if (subCategory != null) { try { subCategoryBLL.Update(subCategory); this._logger.LogInformation($"AdminID : {currentAdmin.ID} is updated SubCategoryID : {subCategory.ID}."); } catch (Exception) { throw; } } } return(View("Index")); } catch (Exception) { throw new Exception(); } }