//
 // GET: /Category/Add
 public ActionResult Add()
 {
     var viewModel = new CategoryViewModel() { Id = 0 };
     //return View();
     return PartialView("_AddOrEdit", viewModel);
 }
        public ActionResult Save(CategoryViewModel categoryViewModel)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    //add
                    if (categoryViewModel.Id == 0)
                    {

                        _iCategoryService.Create(categoryViewModel);
                    }
                    else //edit
                    {
                        var viewModel = _iCategoryService.GetById(categoryViewModel.Id);

                        if (viewModel != null)
                        {

                            _iCategoryService.Update(viewModel);

                        }

                        return Content(KendoUiHelper.GetKendoUiWindowAjaxSuccessMethod(Boolean.FalseString, MessageType.warn.ToString(), ExceptionHelper.ExceptionMessageForNullObject()));

                    }

                    _iCategoryService.Save();

                    return Content(KendoUiHelper.GetKendoUiWindowAjaxSuccessMethod(Boolean.TrueString, MessageType.success.ToString(), "Saved Successfully."));
                }

                return Content(KendoUiHelper.GetKendoUiWindowAjaxSuccessMethod(Boolean.TrueString, MessageType.success.ToString(), ExceptionHelper.ModelStateErrorFormat(ModelState)));
            }
            catch (Exception ex)
            {
                return Content(KendoUiHelper.GetKendoUiWindowAjaxSuccessMethod(Boolean.TrueString, MessageType.success.ToString(), ExceptionHelper.ExceptionMessageFormat(ex)));
            }
        }