public ActionResult Create(ItemCategoryCreateVM model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var  item    = Mapper.Map <ItemCategory>(model);
                    bool isSaved = _itemCategoryManager.Save(item);
                    if (isSaved)
                    {
                        return(RedirectToAction("create"));
                    }
                }
            }
            catch (Exception exception)
            {
                ModelState.AddModelError("", exception.Message);

                var itemCategoryList = _itemCategoryManager.GetAll();
                model.Child = itemCategoryList;
                return(View(model));
            }
            var itemCategory = _itemCategoryManager.GetAll();

            model.Child = itemCategory;
            return(View(model));
        }
 public ActionResult AddCategory(ItemCategoryCreateVM model)
 {
     try
     {
         if (ModelState.IsValid)
         {
             var  itemCategory = Mapper.Map <ItemCategory>(model);
             bool isSaved      = _ItemCategoryManager.Save(itemCategory);
             if (isSaved)
             {
                 return(RedirectToAction("AddCategory"));
             }
         }
     }
     catch (Exception exception)
     {
         ModelState.AddModelError("", exception.Message);
         model.ItemCategories = _ItemCategoryManager.GetAll();
         return(View(model));
     }
     model.ItemCategories = _ItemCategoryManager.GetAll();
     return(View(model));
 }