public JsonResult Create(CategoryDetailView vm)
        {
            CreateCategoryRequest request = new CreateCategoryRequest();

            request.CategoryName = vm.CategoryName;
            request.Description  = vm.Description;
            request.Picture      = vm.Picture;
            CreateCategoryResponse response = _categoryService.CreateCategory(request);

            return(Json(response));
        }
        public JsonResult GetDetail(System.Int32 id)
        {
            CategoryDetailView vm      = new CategoryDetailView();
            GetCategoryRequest request = new GetCategoryRequest();

            request.CategoryID = id;
            GetCategoryResponse response = _categoryService.GetCategory(request);

            if (response.CategoryFound)
            {
                vm = response.Category.ConvertToCategoryDetailView();
            }

            return(Json(vm, JsonRequestBehavior.AllowGet));
        }
        public JsonResult Update(CategoryDetailView vm)
        {
            GetCategoryRequest request = new GetCategoryRequest();

            request.CategoryID = vm.CategoryID;

            ModifyCategoryRequest updateRequest = _categoryService.GetCategory(request).Category.ConvertToModifyCategoryRequest();

            updateRequest.CategoryID   = vm.CategoryID;
            updateRequest.CategoryName = vm.CategoryName;
            updateRequest.Description  = vm.Description;
            updateRequest.Picture      = vm.Picture;

            ModifyCategoryResponse response = _categoryService.ModifyCategory(updateRequest);

            return(Json(response));
        }