public ActionResult AddCategory(CategoryModel category)
        {
            CategoryInfo categoryInfo = category.GetEntity();

            if (ValidationCategoryIsExist(categoryInfo))
            {
                category.CategoryList = DropDownListHelper.GetAllCategorySelectList();
                category.StateMessage = "The same category has already been exist.";
                category.ErrorState = true;
                return View(category);
            }
            else
            {
                this.ICategoryInfoDataProvider.Add(categoryInfo);
                return RedirectToAction("Index");
            }
        }
 public ActionResult EditCategory(CategoryModel category)
 {
     if (category != null && !DropDownListHelper.ValidateCategory(category.ID, category.CategorySelectedID))
     {
         CategoryInfo categoryInfo = category.GetEntity();
         if (ValidationCategoryIsExist(categoryInfo))
         {
             category.CategoryList = DropDownListHelper.GetCategorySelectListBySelectedID(category.CategorySelectedID, category.ID);
             category.StateMessage = "The same category has already been exist.";
             category.ErrorState = true;
             return View(category);
         }
         else
         {
             this.ICategoryInfoDataProvider.Update(categoryInfo);
             return RedirectToAction("Index");
         }
     }
     else
     {
         category.CategoryList = DropDownListHelper.GetCategorySelectListBySelectedID(category.CategorySelectedID, category.ID);
         category.StateMessage = "The parent category cannot choose a subcategory of itself.";
         category.ErrorState = true;
         return View(category);
     }
 }