public ActionResult DispalyCategory()
        {

            CategoryViewModel cData = new CategoryViewModel();
            var list = _categoryBusiness.GetAllCategory().ToList();
            return PartialView("_categoryList", list);
        }
        public ActionResult Create(CategoryViewModel categoryViewModel)
        {
            if (ModelState.IsValid)
            {
                Mapper.CreateMap<CategoryViewModel, Category>();
                Category category = Mapper.Map<CategoryViewModel, Category>(categoryViewModel);

                var result = _categoryBusiness.ValidateCategory(category, "I");

                if (!string.IsNullOrEmpty(result))
                {
                    ModelState.AddModelError("", result);
                    return View(categoryViewModel);
                }
                //int vid = _versionDataBusiness.GetUnpublishedVersion();
                //if (vid == 0)
                //{
                //    ModelState.AddModelError("", "New unpublished version not detected. Can not proceed. Create new version with out publishing it and try again.");
                //    TempData["Success"] = "New unpublished version not detected. Can not proceed. Create new version with out publishing it and try again.";
                //    TempData["isSuccess"] = "false";
                //    return RedirectToAction("Index");
                //}
                else
                {
                    category.EncId = Md5Encryption.Encrypt(category.CategoryId.ToString());
                    bool isSuccess = _categoryBusiness.AddUpdateDeleteCategory(category, "I");
                    if (isSuccess)
                    {
                        TempData["Success"] = "Category Created Successfully!!";
                        TempData["isSuccess"] = "true";
                        return RedirectToAction("Index");
                    }
                    else
                    {
                        TempData["Success"] = "Failed to create category!!";
                        TempData["isSuccess"] = "false";
                    }
                }
            }
            return View(categoryViewModel);

        }
        public ActionResult Create()
        {
            CategoryViewModel categoryViewModel = new CategoryViewModel();

            return View(categoryViewModel);
        }
        public ActionResult Edit(CategoryViewModel categoryViewModel, String Id)
        {

            int id = Convert.ToInt32(Md5Decryption.Decrypt(Id));
            categoryViewModel.CategoryId = id;
            if (ModelState.IsValid)
            {
                Mapper.CreateMap<CategoryViewModel, Category>();
                Category brand = Mapper.Map<CategoryViewModel, Category>(categoryViewModel);

                var result = _categoryBusiness.ValidateCategory(brand, "U");
                if (!string.IsNullOrEmpty(result))
                {
                    ModelState.AddModelError("", result);
                    return View(categoryViewModel);
                }
                //int vid = _versionDataBusiness.GetUnpublishedVersion();
                //if (vid == 0)
                //{
                //    ModelState.AddModelError("", "New unpublished version not detected. Can not proceed. Create new version with out publishing it and try again.");
                //    TempData["Success"] = "New unpublished version not detected. Can not proceed. Create new version with out publishing it and try again.";
                //    TempData["isSuccess"] = "false";
                //    return RedirectToAction("Index");
                //}
                //else
                {

                    bool isSuccess = _categoryBusiness.AddUpdateDeleteCategory(brand, "U");
                    if (isSuccess)
                    {
                        TempData["Success"] = "Category Updated Successfully!!";
                        TempData["isSuccess"] = "true";

                        return RedirectToAction("Index");
                    }
                    else
                    {
                        TempData["Success"] = "Failed to update Category!!";
                        TempData["isSuccess"] = "false";
                    }
                }
            }
            return View(categoryViewModel);
        }